Add test utilities for C++ and Java

Summary:
@public

Test utility on top of the new event system that maintains a counter of instantiated nodes. Meant to replace the global node counter.

Reviewed By: SidharthGuglani

Differential Revision: D15174855

fbshipit-source-id: 6998472f95a09b8da652257a26596164bdcf43d6
This commit is contained in:
David Aurelio
2019-05-09 04:14:08 -07:00
committed by Facebook Github Bot
parent 88b23ebb3d
commit 6e04631862
11 changed files with 221 additions and 20 deletions

View File

@@ -24,6 +24,10 @@ std::function<Event::Subscriber>& globalEventSubscriber() {
} // namespace
void Event::reset() {
globalEventSubscriber() = nullptr;
}
void Event::subscribe(std::function<Subscriber>&& subscriber) {
if (globalEventSubscriber() != nullptr) {
throw std::logic_error(

View File

@@ -35,6 +35,8 @@ struct Event {
};
};
static void reset();
static void subscribe(std::function<Subscriber>&& subscriber);
template <Type E>