1 #include "../test.h" 2 3 SCENARIO("empty emits no items", "[empty][sources]"){ 4 GIVEN("an empty source"){ 5 auto sc = rxsc::make_test(); 6 auto w = sc.create_worker(); 7 const rxsc::test::messages<int> on; 8 9 WHEN("created"){ 10 11 auto res = w.start( __anonefde8fe70102() 12 []() { 13 return rx::observable<>::empty<int>() 14 // forget type to workaround lambda deduction bug on msvc 2013 15 .as_dynamic(); 16 } 17 ); 18 19 THEN("the output only contains the completion message"){ 20 auto required = rxu::to_vector({ 21 on.completed(200) 22 }); 23 auto actual = res.get_observer().messages(); 24 REQUIRE(required == actual); 25 } 26 27 } 28 } 29 } 30 31 SCENARIO("empty emits no items (rx::sources)", "[empty][sources]"){ 32 GIVEN("an empty source"){ 33 auto sc = rxsc::make_test(); 34 auto w = sc.create_worker(); 35 const rxsc::test::messages<int> on; 36 37 WHEN("created"){ 38 using namespace rx::sources; 39 40 auto res = w.start( __anonefde8fe70202() 41 []() { 42 return empty<int>() 43 // forget type to workaround lambda deduction bug on msvc 2013 44 .as_dynamic(); 45 } 46 ); 47 48 THEN("the output only contains the completion message"){ 49 auto required = rxu::to_vector({ 50 on.completed(200) 51 }); 52 auto actual = res.get_observer().messages(); 53 REQUIRE(required == actual); 54 } 55 56 } 57 } 58 } 59