diff options
author | Valeriy Kopylov <valery.kopylov@akvelon.com> | 2014-08-08 14:00:20 +0400 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2014-08-11 16:40:47 -0700 |
commit | 8e617019b3a111624de99309c2febbf5d27a41ab (patch) | |
tree | d998de0672c9983b72cbd0ffbac918df22e8678b /Rx/v2/test/sources | |
parent | 609ec19178ac2c383f52571cf0d9ee7c2d1df527 (diff) | |
download | RxCpp-8e617019b3a111624de99309c2febbf5d27a41ab.tar.gz |
Small changes on scope operator
Diffstat (limited to 'Rx/v2/test/sources')
-rw-r--r-- | Rx/v2/test/sources/scope.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp index 4201b50..b8d36cb 100644 --- a/Rx/v2/test/sources/scope.cpp +++ b/Rx/v2/test/sources/scope.cpp @@ -25,7 +25,7 @@ SCENARIO("scope, cold observable", "[scope][sources]"){ [&](){ return resource(rxu::to_vector({1, 2, 3, 4, 5})); }, - [&](resource& r){ + [&](resource r){ auto msg = std::vector<rxsc::test::messages<int>::recorded_type>(); int time = 10; auto values = r.get(); @@ -86,7 +86,7 @@ SCENARIO("scope, hot observable", "[scope][sources]"){ [&](){ return resource(rxu::to_vector({1, 2, 3, 4, 5})); }, - [&](resource& r){ + [&](resource r){ auto msg = std::vector<rxsc::test::messages<int>::recorded_type>(); int time = 210; auto values = r.get(); @@ -151,7 +151,7 @@ SCENARIO("scope, complete", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -218,7 +218,7 @@ SCENARIO("scope, error", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -283,7 +283,7 @@ SCENARIO("scope, dispose", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -335,6 +335,8 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ int resource_factory_invoked = 0; int observable_factory_invoked = 0; + typedef rx::resource<int> resource; + WHEN("created by scope"){ auto res = w.start( @@ -344,9 +346,9 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ [&](){ ++resource_factory_invoked; throw ex; - return rx::make_subscription(); + return resource(sc.clock()); }, - [&](rx::subscription& s){ + [&](resource r){ ++observable_factory_invoked; return rx::observable<>::never<int>(); } @@ -386,6 +388,8 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ int resource_factory_invoked = 0; int observable_factory_invoked = 0; + typedef rx::resource<int> resource; + WHEN("created by scope"){ auto res = w.start( @@ -394,9 +398,9 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ scope( [&](){ ++resource_factory_invoked; - return rx::make_subscription(); + return resource(sc.clock()); }, - [&](rx::subscription& s){ + [&](resource r){ ++observable_factory_invoked; throw ex; return rx::observable<>::never<int>(); |