================
@@ -57,53 +157,84 @@ template <typename T> class JSONTransportTest : public 
PipePairTest {
                                      NativeFile::Unowned));
   }
 
-  template <typename P>
-  Expected<P>
-  RunOnce(std::chrono::milliseconds timeout = std::chrono::seconds(1)) {
-    std::promise<Expected<P>> promised_message;
-    std::future<Expected<P>> future_message = promised_message.get_future();
-    RunUntil<P>(
-        [&promised_message](Expected<P> message) mutable -> bool {
-          promised_message.set_value(std::move(message));
-          return /*keep_going*/ false;
-        },
-        timeout);
-    return future_message.get();
+  class MessageCollector final
----------------
labath wrote:

There isn't anything json-specific here is it? Could this be moved to 
unittest/TestingSupport/Host (as a template) to avoid redefining it in each 
file?

I'd also consider making this a mock (MOCK_METHOD1(OnEvent, void(const Evt 
&V))`. This essentially handrolls a mock object, but googlemock is more 
flexible (e.g. lets you match the order of events) and powerful (lets you check 
that a message was received through the right API), and probably does that in 
fewer LOC.

https://github.com/llvm/llvm-project/pull/153121
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to