rx 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +22 -0
- data/.gitignore +173 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/Rakefile +11 -0
- data/examples/aggregate.rb +39 -0
- data/examples/amb.rb +25 -0
- data/examples/ambproto.rb +24 -0
- data/examples/and.rb +26 -0
- data/examples/as_observable.rb +25 -0
- data/examples/average.rb +43 -0
- data/examples/buffer_with_count.rb +44 -0
- data/examples/buffer_with_time.rb +51 -0
- data/examples/case.rb +29 -0
- data/examples/catch.rb +20 -0
- data/examples/catchproto.rb +39 -0
- data/examples/combine_latest.rb +35 -0
- data/examples/combine_latestproto.rb +33 -0
- data/examples/concat.rb +22 -0
- data/examples/concat_all.rb +27 -0
- data/examples/concat_map.rb +61 -0
- data/examples/concat_map_observer.rb +29 -0
- data/examples/concatproto.rb +25 -0
- data/examples/connect.rb +41 -0
- data/examples/contains.rb +37 -0
- data/examples/count.rb +36 -0
- data/examples/create.rb +55 -0
- data/examples/debounce.rb +35 -0
- data/examples/default_if_empty.rb +35 -0
- data/examples/defer.rb +20 -0
- data/examples/delay.rb +49 -0
- data/examples/delay_with_selector.rb +63 -0
- data/examples/dematerialize.rb +22 -0
- data/examples/disposable.rb +12 -0
- data/examples/distinct.rb +43 -0
- data/examples/distinct_until_changed.rb +43 -0
- data/examples/do.rb +59 -0
- data/examples/empty.rb +16 -0
- data/examples/for.rb +26 -0
- data/examples/fork_join.rb +23 -0
- data/examples/from.rb +106 -0
- data/examples/from_array.rb +21 -0
- data/examples/from_callback.rb +21 -0
- data/examples/generate.rb +24 -0
- data/examples/group_join.rb +39 -0
- data/examples/if.rb +46 -0
- data/examples/intervals.rb +26 -0
- data/examples/merge.rb +36 -0
- data/examples/merge_all.rb +27 -0
- data/examples/multicast.rb +32 -0
- data/examples/never.rb +15 -0
- data/examples/of.rb +19 -0
- data/examples/on_error_resume_next.rb +21 -0
- data/examples/pairs.rb +26 -0
- data/examples/publish.rb +79 -0
- data/examples/range.rb +19 -0
- data/examples/reduce.rb +18 -0
- data/examples/repeat.rb +19 -0
- data/examples/return.rb +17 -0
- data/examples/scan.rb +41 -0
- data/examples/start.rb +29 -0
- data/examples/throw.rb +17 -0
- data/examples/time_intervals.rb +28 -0
- data/examples/timer.rb +26 -0
- data/examples/timestamp.rb +28 -0
- data/examples/to_a.rb +23 -0
- data/examples/to_async.rb +26 -0
- data/examples/using.rb +52 -0
- data/examples/when.rb +26 -0
- data/examples/while.rb +25 -0
- data/examples/window_with_time.rb +78 -0
- data/examples/zip.rb +27 -0
- data/examples/zip_array.rb +25 -0
- data/lib/core_ext/enumerable.rb +22 -0
- data/lib/rx_ruby.rb +27 -0
- data/lib/rx_ruby/concurrency/async_lock.rb +57 -0
- data/lib/rx_ruby/concurrency/current_thread_scheduler.rb +75 -0
- data/lib/rx_ruby/concurrency/default_scheduler.rb +51 -0
- data/lib/rx_ruby/concurrency/historical_scheduler.rb +16 -0
- data/lib/rx_ruby/concurrency/immediate_scheduler.rb +68 -0
- data/lib/rx_ruby/concurrency/local_scheduler.rb +39 -0
- data/lib/rx_ruby/concurrency/periodic_scheduler.rb +74 -0
- data/lib/rx_ruby/concurrency/scheduled_item.rb +42 -0
- data/lib/rx_ruby/concurrency/scheduler.rb +150 -0
- data/lib/rx_ruby/concurrency/virtual_time_scheduler.rb +170 -0
- data/lib/rx_ruby/core/async_lock_observer.rb +46 -0
- data/lib/rx_ruby/core/auto_detach_observer.rb +59 -0
- data/lib/rx_ruby/core/checked_observer.rb +66 -0
- data/lib/rx_ruby/core/notification.rb +161 -0
- data/lib/rx_ruby/core/observable.rb +104 -0
- data/lib/rx_ruby/core/observe_on_observer.rb +50 -0
- data/lib/rx_ruby/core/observer.rb +119 -0
- data/lib/rx_ruby/core/scheduled_observer.rb +83 -0
- data/lib/rx_ruby/core/synchronized_observer.rb +47 -0
- data/lib/rx_ruby/core/time_interval.rb +17 -0
- data/lib/rx_ruby/internal/priority_queue.rb +122 -0
- data/lib/rx_ruby/internal/util.rb +9 -0
- data/lib/rx_ruby/joins/active_plan.rb +45 -0
- data/lib/rx_ruby/joins/join_observer.rb +51 -0
- data/lib/rx_ruby/joins/pattern.rb +14 -0
- data/lib/rx_ruby/joins/plan.rb +44 -0
- data/lib/rx_ruby/linq/connectable_observable.rb +34 -0
- data/lib/rx_ruby/linq/observable/_observable_timer_date_and_period.rb +22 -0
- data/lib/rx_ruby/linq/observable/_observable_timer_time_span.rb +14 -0
- data/lib/rx_ruby/linq/observable/_observable_timer_time_span_and_period.rb +20 -0
- data/lib/rx_ruby/linq/observable/aggregate.rb +7 -0
- data/lib/rx_ruby/linq/observable/and.rb +7 -0
- data/lib/rx_ruby/linq/observable/case.rb +15 -0
- data/lib/rx_ruby/linq/observable/concat_all.rb +7 -0
- data/lib/rx_ruby/linq/observable/concat_map.rb +35 -0
- data/lib/rx_ruby/linq/observable/concat_map_observer.rb +43 -0
- data/lib/rx_ruby/linq/observable/contains.rb +28 -0
- data/lib/rx_ruby/linq/observable/debounce.rb +41 -0
- data/lib/rx_ruby/linq/observable/delay.rb +81 -0
- data/lib/rx_ruby/linq/observable/delay_with_selector.rb +64 -0
- data/lib/rx_ruby/linq/observable/do.rb +42 -0
- data/lib/rx_ruby/linq/observable/for.rb +13 -0
- data/lib/rx_ruby/linq/observable/fork_join.rb +55 -0
- data/lib/rx_ruby/linq/observable/from.rb +34 -0
- data/lib/rx_ruby/linq/observable/group_join.rb +108 -0
- data/lib/rx_ruby/linq/observable/if.rb +17 -0
- data/lib/rx_ruby/linq/observable/interval.rb +5 -0
- data/lib/rx_ruby/linq/observable/multicast.rb +14 -0
- data/lib/rx_ruby/linq/observable/of.rb +11 -0
- data/lib/rx_ruby/linq/observable/pairs.rb +7 -0
- data/lib/rx_ruby/linq/observable/pluck.rb +7 -0
- data/lib/rx_ruby/linq/observable/publish.rb +11 -0
- data/lib/rx_ruby/linq/observable/start.rb +7 -0
- data/lib/rx_ruby/linq/observable/time_interval.rb +15 -0
- data/lib/rx_ruby/linq/observable/timer.rb +26 -0
- data/lib/rx_ruby/linq/observable/timestamp.rb +9 -0
- data/lib/rx_ruby/linq/observable/to_async.rb +40 -0
- data/lib/rx_ruby/linq/observable/when.rb +36 -0
- data/lib/rx_ruby/linq/observable/while.rb +41 -0
- data/lib/rx_ruby/operators/aggregates.rb +611 -0
- data/lib/rx_ruby/operators/creation.rb +220 -0
- data/lib/rx_ruby/operators/multiple.rb +735 -0
- data/lib/rx_ruby/operators/single.rb +399 -0
- data/lib/rx_ruby/operators/standard_query_operators.rb +279 -0
- data/lib/rx_ruby/operators/synchronization.rb +47 -0
- data/lib/rx_ruby/operators/time.rb +120 -0
- data/lib/rx_ruby/subjects/async_subject.rb +161 -0
- data/lib/rx_ruby/subjects/behavior_subject.rb +149 -0
- data/lib/rx_ruby/subjects/replay_subject.rb +39 -0
- data/lib/rx_ruby/subjects/subject.rb +131 -0
- data/lib/rx_ruby/subjects/subject_extensions.rb +45 -0
- data/lib/rx_ruby/subscriptions/composite_subscription.rb +91 -0
- data/lib/rx_ruby/subscriptions/ref_count_subscription.rb +88 -0
- data/lib/rx_ruby/subscriptions/scheduled_subscription.rb +32 -0
- data/lib/rx_ruby/subscriptions/serial_subscription.rb +60 -0
- data/lib/rx_ruby/subscriptions/single_assignment_subscription.rb +64 -0
- data/lib/rx_ruby/subscriptions/subscription.rb +56 -0
- data/lib/rx_ruby/testing/cold_observable.rb +45 -0
- data/lib/rx_ruby/testing/hot_observable.rb +47 -0
- data/lib/rx_ruby/testing/mock_observer.rb +33 -0
- data/lib/rx_ruby/testing/reactive_test.rb +94 -0
- data/lib/rx_ruby/testing/recorded.rb +17 -0
- data/lib/rx_ruby/testing/test_scheduler.rb +96 -0
- data/lib/rx_ruby/testing/test_subscription.rb +22 -0
- data/lib/rx_ruby/version.rb +3 -0
- data/license.txt +13 -0
- data/readme.md +152 -0
- data/rx_ruby.gemspec +22 -0
- data/test/rx_ruby/concurrency/helpers/historical_virtual_scheduler_helper.rb +135 -0
- data/test/rx_ruby/concurrency/helpers/immediate_local_scheduler_helper.rb +51 -0
- data/test/rx_ruby/concurrency/test_async_lock.rb +56 -0
- data/test/rx_ruby/concurrency/test_current_thread_scheduler.rb +44 -0
- data/test/rx_ruby/concurrency/test_default_scheduler.rb +44 -0
- data/test/rx_ruby/concurrency/test_historical_scheduler.rb +18 -0
- data/test/rx_ruby/concurrency/test_immediate_scheduler.rb +53 -0
- data/test/rx_ruby/concurrency/test_local_scheduler.rb +12 -0
- data/test/rx_ruby/concurrency/test_periodic_scheduler.rb +53 -0
- data/test/rx_ruby/concurrency/test_scheduled_item.rb +50 -0
- data/test/rx_ruby/concurrency/test_scheduler.rb +128 -0
- data/test/rx_ruby/concurrency/test_virtual_time_scheduler.rb +14 -0
- data/test/rx_ruby/core/test_notification.rb +129 -0
- data/test/rx_ruby/core/test_observable_creation.rb +483 -0
- data/test/rx_ruby/core/test_observer.rb +634 -0
- data/test/rx_ruby/internal/test_priority_queue.rb +71 -0
- data/test/rx_ruby/subscriptions/test_composite_subscription.rb +116 -0
- data/test/rx_ruby/subscriptions/test_serial_subscription.rb +62 -0
- data/test/rx_ruby/subscriptions/test_singleassignment_subscription.rb +61 -0
- data/test/rx_ruby/subscriptions/test_subscription.rb +27 -0
- data/test/test_helper.rb +11 -0
- metadata +291 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestPriorityQueue < Minitest::Test
|
6
|
+
|
7
|
+
def test_simple_push_and_shift
|
8
|
+
queue = RxRuby::PriorityQueue.new
|
9
|
+
queue.push 400
|
10
|
+
|
11
|
+
assert_equal 400, queue.shift
|
12
|
+
assert !queue.shift
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_shift_with_priority
|
16
|
+
queue = RxRuby::PriorityQueue.new
|
17
|
+
queue.push 400
|
18
|
+
queue.push 300
|
19
|
+
queue.push 500
|
20
|
+
|
21
|
+
assert_equal 300, queue.shift
|
22
|
+
assert_equal 400, queue.shift
|
23
|
+
assert_equal 500, queue.shift
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_delete
|
27
|
+
queue = RxRuby::PriorityQueue.new
|
28
|
+
[1, 4, 5, 2, 3].each {|it| queue.push it }
|
29
|
+
|
30
|
+
assert !queue.delete(404)
|
31
|
+
assert queue.delete(3)
|
32
|
+
assert_equal 1, queue.shift
|
33
|
+
assert_equal 2, queue.shift
|
34
|
+
assert_equal 4, queue.shift
|
35
|
+
assert_equal 5, queue.shift
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_push_thread_safety
|
39
|
+
queue = RxRuby::PriorityQueue.new
|
40
|
+
5.times.map {
|
41
|
+
Thread.new do
|
42
|
+
100.times do |i|
|
43
|
+
queue.push i
|
44
|
+
end
|
45
|
+
end
|
46
|
+
}.each(&:join)
|
47
|
+
assert_equal 500, queue.length
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_shift_thread_safety
|
51
|
+
queue = RxRuby::PriorityQueue.new
|
52
|
+
500.times {|i| queue.push i }
|
53
|
+
|
54
|
+
5.times.map {
|
55
|
+
Thread.new do
|
56
|
+
100.times do |i|
|
57
|
+
queue.shift
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}.each(&:join)
|
61
|
+
assert_equal 0, queue.length
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_delete_same_item
|
65
|
+
queue = RxRuby::PriorityQueue.new
|
66
|
+
10.times { queue.push 42 }
|
67
|
+
queue.delete 42
|
68
|
+
assert_equal 9, queue.length
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestCompositeSubscription < Minitest::Test
|
6
|
+
|
7
|
+
def test_include
|
8
|
+
d1 = RxRuby::Subscription.create { }
|
9
|
+
d2 = RxRuby::Subscription.create { }
|
10
|
+
|
11
|
+
g = RxRuby::CompositeSubscription.new([d1, d2])
|
12
|
+
|
13
|
+
assert_equal 2, g.length
|
14
|
+
assert g.include? d1
|
15
|
+
assert g.include? d2
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_to_a
|
19
|
+
d1 = RxRuby::Subscription.create { }
|
20
|
+
d2 = RxRuby::Subscription.create { }
|
21
|
+
|
22
|
+
ds = [d1, d2]
|
23
|
+
g = RxRuby::CompositeSubscription.new([d1, d2])
|
24
|
+
|
25
|
+
assert_equal 2, g.length
|
26
|
+
|
27
|
+
x = g.to_a
|
28
|
+
x.each_with_index do |item, index|
|
29
|
+
assert_equal ds[index], item
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_push
|
34
|
+
d1 = RxRuby::Subscription.create { }
|
35
|
+
d2 = RxRuby::Subscription.create { }
|
36
|
+
g = RxRuby::CompositeSubscription.new([d1])
|
37
|
+
|
38
|
+
assert_equal 1, g.length
|
39
|
+
assert g.include? d1
|
40
|
+
|
41
|
+
g.push d2
|
42
|
+
|
43
|
+
assert_equal 2, g.length
|
44
|
+
assert g.include? d2
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_push_after_dispose
|
48
|
+
disp1 = false
|
49
|
+
disp2 = false
|
50
|
+
|
51
|
+
d1 = RxRuby::Subscription.create { disp1 = true }
|
52
|
+
d2 = RxRuby::Subscription.create { disp2 = true }
|
53
|
+
g = RxRuby::CompositeSubscription.new [d1]
|
54
|
+
assert_equal 1, g.length
|
55
|
+
|
56
|
+
g.unsubscribe
|
57
|
+
assert disp1
|
58
|
+
assert_equal 0, g.length
|
59
|
+
|
60
|
+
g.push d2
|
61
|
+
assert disp2
|
62
|
+
assert_equal 0, g.length
|
63
|
+
|
64
|
+
assert g.unsubscribed?
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_remove
|
68
|
+
disp1 = false
|
69
|
+
disp2 = false
|
70
|
+
|
71
|
+
d1 = RxRuby::Subscription.create { disp1 = true }
|
72
|
+
d2 = RxRuby::Subscription.create { disp2 = true }
|
73
|
+
g = RxRuby::CompositeSubscription.new [d1, d2]
|
74
|
+
|
75
|
+
assert_equal 2, g.length
|
76
|
+
assert g.include? d1
|
77
|
+
assert g.include? d2
|
78
|
+
|
79
|
+
refute_nil g.delete d1
|
80
|
+
assert_equal 1, g.length
|
81
|
+
refute g.include? d1
|
82
|
+
assert g.include? d2
|
83
|
+
assert disp1
|
84
|
+
|
85
|
+
refute_nil g.delete d2
|
86
|
+
refute g.include? d1
|
87
|
+
refute g.include? d2
|
88
|
+
assert disp2
|
89
|
+
|
90
|
+
disp3 = false
|
91
|
+
d3 = RxRuby::Subscription.create { disp3 = true }
|
92
|
+
assert_nil g.delete d3
|
93
|
+
refute disp3
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_clear
|
97
|
+
disp1 = false
|
98
|
+
disp2 = false
|
99
|
+
|
100
|
+
d1 = RxRuby::Subscription.create { disp1 = true }
|
101
|
+
d2 = RxRuby::Subscription.create { disp2 = true }
|
102
|
+
g = RxRuby::CompositeSubscription.new [d1, d2]
|
103
|
+
assert_equal 2, g.length
|
104
|
+
|
105
|
+
g.clear
|
106
|
+
assert disp1
|
107
|
+
assert disp2
|
108
|
+
assert_equal 0, g.length
|
109
|
+
|
110
|
+
disp3 = false
|
111
|
+
d3 = RxRuby::Subscription.create { disp3 = true }
|
112
|
+
g.push d3
|
113
|
+
refute disp3
|
114
|
+
assert_equal 1, g.length
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestSerialSubscription < Minitest::Test
|
6
|
+
|
7
|
+
def test_ctor
|
8
|
+
d = RxRuby::SerialSubscription.new
|
9
|
+
assert_nil d.subscription
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_replace_before_dispose
|
13
|
+
disp1 = false
|
14
|
+
disp2 = false
|
15
|
+
|
16
|
+
m = RxRuby::SerialSubscription.new
|
17
|
+
d1 = RxRuby::Subscription.create { disp1 = true }
|
18
|
+
m.subscription = d1
|
19
|
+
assert_same d1, m.subscription
|
20
|
+
refute disp1
|
21
|
+
|
22
|
+
d2 = RxRuby::Subscription.create { disp2 = true }
|
23
|
+
m.subscription = d2
|
24
|
+
assert_same d2, m.subscription
|
25
|
+
assert disp1
|
26
|
+
refute disp2
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_replace_after_dispose
|
30
|
+
disp1 = false
|
31
|
+
disp2 = false
|
32
|
+
|
33
|
+
m = RxRuby::SerialSubscription.new
|
34
|
+
m.unsubscribe
|
35
|
+
assert m.unsubscribed?
|
36
|
+
|
37
|
+
d1 = RxRuby::Subscription.create { disp1 = true }
|
38
|
+
m.subscription = d1
|
39
|
+
assert_nil m.subscription
|
40
|
+
assert disp1
|
41
|
+
|
42
|
+
d2 = RxRuby::Subscription.create { disp2 = true }
|
43
|
+
m.subscription = d2
|
44
|
+
assert_nil m.subscription
|
45
|
+
assert disp2
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_dispose
|
49
|
+
disp = false
|
50
|
+
|
51
|
+
m = RxRuby::SerialSubscription.new
|
52
|
+
d = RxRuby::Subscription.create { disp = true }
|
53
|
+
m.subscription = d
|
54
|
+
assert_same d, m.subscription
|
55
|
+
refute disp
|
56
|
+
|
57
|
+
m.unsubscribe
|
58
|
+
assert m.unsubscribed?
|
59
|
+
assert disp
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestSingleAssignmentSubscription < Minitest::Test
|
6
|
+
|
7
|
+
def test_subscription_null
|
8
|
+
d = RxRuby::SingleAssignmentSubscription.new
|
9
|
+
d.subscription = nil
|
10
|
+
|
11
|
+
assert_nil d.subscription
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_dispose_after_set
|
15
|
+
unsubscribed = false
|
16
|
+
|
17
|
+
d = RxRuby::SingleAssignmentSubscription.new
|
18
|
+
dd = RxRuby::Subscription.create { unsubscribed = true }
|
19
|
+
d.subscription = dd
|
20
|
+
|
21
|
+
assert_same dd, d.subscription
|
22
|
+
|
23
|
+
refute unsubscribed
|
24
|
+
|
25
|
+
d.unsubscribe
|
26
|
+
|
27
|
+
assert unsubscribed
|
28
|
+
|
29
|
+
d.unsubscribe
|
30
|
+
|
31
|
+
assert unsubscribed
|
32
|
+
assert d.unsubscribed?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_dispose_before_set
|
36
|
+
unsubscribed = false
|
37
|
+
|
38
|
+
d = RxRuby::SingleAssignmentSubscription.new
|
39
|
+
dd = RxRuby::Subscription.create { unsubscribed = true }
|
40
|
+
|
41
|
+
refute unsubscribed
|
42
|
+
d.unsubscribe
|
43
|
+
refute unsubscribed
|
44
|
+
assert d.unsubscribed?
|
45
|
+
|
46
|
+
d.subscription = dd
|
47
|
+
assert unsubscribed
|
48
|
+
assert d.subscription.nil?
|
49
|
+
d.unsubscribe #should be noop
|
50
|
+
|
51
|
+
assert unsubscribed
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_dispose_multiple_times
|
55
|
+
d = RxRuby::SingleAssignmentSubscription.new
|
56
|
+
d.subscription = RxRuby::Subscription.empty
|
57
|
+
|
58
|
+
assert_raises(RuntimeError) { d.subscription = RxRuby::Subscription.empty }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TestSubscription < Minitest::Test
|
6
|
+
|
7
|
+
def test_disposable_create
|
8
|
+
d = RxRuby::Subscription.create { }
|
9
|
+
refute_nil d
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_create_dispose
|
13
|
+
unsubscribed = false
|
14
|
+
d = RxRuby::Subscription.create { unsubscribed = true }
|
15
|
+
refute unsubscribed
|
16
|
+
|
17
|
+
d.unsubscribe
|
18
|
+
assert unsubscribed
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_empty
|
22
|
+
d = RxRuby::Subscription.empty
|
23
|
+
refute_nil d
|
24
|
+
d.unsubscribe
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Microsoft Open Technologies, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Reactive Extensions for Ruby
|
56
|
+
email:
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- ".gitattributes"
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- Rakefile
|
66
|
+
- examples/aggregate.rb
|
67
|
+
- examples/amb.rb
|
68
|
+
- examples/ambproto.rb
|
69
|
+
- examples/and.rb
|
70
|
+
- examples/as_observable.rb
|
71
|
+
- examples/average.rb
|
72
|
+
- examples/buffer_with_count.rb
|
73
|
+
- examples/buffer_with_time.rb
|
74
|
+
- examples/case.rb
|
75
|
+
- examples/catch.rb
|
76
|
+
- examples/catchproto.rb
|
77
|
+
- examples/combine_latest.rb
|
78
|
+
- examples/combine_latestproto.rb
|
79
|
+
- examples/concat.rb
|
80
|
+
- examples/concat_all.rb
|
81
|
+
- examples/concat_map.rb
|
82
|
+
- examples/concat_map_observer.rb
|
83
|
+
- examples/concatproto.rb
|
84
|
+
- examples/connect.rb
|
85
|
+
- examples/contains.rb
|
86
|
+
- examples/count.rb
|
87
|
+
- examples/create.rb
|
88
|
+
- examples/debounce.rb
|
89
|
+
- examples/default_if_empty.rb
|
90
|
+
- examples/defer.rb
|
91
|
+
- examples/delay.rb
|
92
|
+
- examples/delay_with_selector.rb
|
93
|
+
- examples/dematerialize.rb
|
94
|
+
- examples/disposable.rb
|
95
|
+
- examples/distinct.rb
|
96
|
+
- examples/distinct_until_changed.rb
|
97
|
+
- examples/do.rb
|
98
|
+
- examples/empty.rb
|
99
|
+
- examples/for.rb
|
100
|
+
- examples/fork_join.rb
|
101
|
+
- examples/from.rb
|
102
|
+
- examples/from_array.rb
|
103
|
+
- examples/from_callback.rb
|
104
|
+
- examples/generate.rb
|
105
|
+
- examples/group_join.rb
|
106
|
+
- examples/if.rb
|
107
|
+
- examples/intervals.rb
|
108
|
+
- examples/merge.rb
|
109
|
+
- examples/merge_all.rb
|
110
|
+
- examples/multicast.rb
|
111
|
+
- examples/never.rb
|
112
|
+
- examples/of.rb
|
113
|
+
- examples/on_error_resume_next.rb
|
114
|
+
- examples/pairs.rb
|
115
|
+
- examples/publish.rb
|
116
|
+
- examples/range.rb
|
117
|
+
- examples/reduce.rb
|
118
|
+
- examples/repeat.rb
|
119
|
+
- examples/return.rb
|
120
|
+
- examples/scan.rb
|
121
|
+
- examples/start.rb
|
122
|
+
- examples/throw.rb
|
123
|
+
- examples/time_intervals.rb
|
124
|
+
- examples/timer.rb
|
125
|
+
- examples/timestamp.rb
|
126
|
+
- examples/to_a.rb
|
127
|
+
- examples/to_async.rb
|
128
|
+
- examples/using.rb
|
129
|
+
- examples/when.rb
|
130
|
+
- examples/while.rb
|
131
|
+
- examples/window_with_time.rb
|
132
|
+
- examples/zip.rb
|
133
|
+
- examples/zip_array.rb
|
134
|
+
- lib/core_ext/enumerable.rb
|
135
|
+
- lib/rx_ruby.rb
|
136
|
+
- lib/rx_ruby/concurrency/async_lock.rb
|
137
|
+
- lib/rx_ruby/concurrency/current_thread_scheduler.rb
|
138
|
+
- lib/rx_ruby/concurrency/default_scheduler.rb
|
139
|
+
- lib/rx_ruby/concurrency/historical_scheduler.rb
|
140
|
+
- lib/rx_ruby/concurrency/immediate_scheduler.rb
|
141
|
+
- lib/rx_ruby/concurrency/local_scheduler.rb
|
142
|
+
- lib/rx_ruby/concurrency/periodic_scheduler.rb
|
143
|
+
- lib/rx_ruby/concurrency/scheduled_item.rb
|
144
|
+
- lib/rx_ruby/concurrency/scheduler.rb
|
145
|
+
- lib/rx_ruby/concurrency/virtual_time_scheduler.rb
|
146
|
+
- lib/rx_ruby/core/async_lock_observer.rb
|
147
|
+
- lib/rx_ruby/core/auto_detach_observer.rb
|
148
|
+
- lib/rx_ruby/core/checked_observer.rb
|
149
|
+
- lib/rx_ruby/core/notification.rb
|
150
|
+
- lib/rx_ruby/core/observable.rb
|
151
|
+
- lib/rx_ruby/core/observe_on_observer.rb
|
152
|
+
- lib/rx_ruby/core/observer.rb
|
153
|
+
- lib/rx_ruby/core/scheduled_observer.rb
|
154
|
+
- lib/rx_ruby/core/synchronized_observer.rb
|
155
|
+
- lib/rx_ruby/core/time_interval.rb
|
156
|
+
- lib/rx_ruby/internal/priority_queue.rb
|
157
|
+
- lib/rx_ruby/internal/util.rb
|
158
|
+
- lib/rx_ruby/joins/active_plan.rb
|
159
|
+
- lib/rx_ruby/joins/join_observer.rb
|
160
|
+
- lib/rx_ruby/joins/pattern.rb
|
161
|
+
- lib/rx_ruby/joins/plan.rb
|
162
|
+
- lib/rx_ruby/linq/connectable_observable.rb
|
163
|
+
- lib/rx_ruby/linq/observable/_observable_timer_date_and_period.rb
|
164
|
+
- lib/rx_ruby/linq/observable/_observable_timer_time_span.rb
|
165
|
+
- lib/rx_ruby/linq/observable/_observable_timer_time_span_and_period.rb
|
166
|
+
- lib/rx_ruby/linq/observable/aggregate.rb
|
167
|
+
- lib/rx_ruby/linq/observable/and.rb
|
168
|
+
- lib/rx_ruby/linq/observable/case.rb
|
169
|
+
- lib/rx_ruby/linq/observable/concat_all.rb
|
170
|
+
- lib/rx_ruby/linq/observable/concat_map.rb
|
171
|
+
- lib/rx_ruby/linq/observable/concat_map_observer.rb
|
172
|
+
- lib/rx_ruby/linq/observable/contains.rb
|
173
|
+
- lib/rx_ruby/linq/observable/debounce.rb
|
174
|
+
- lib/rx_ruby/linq/observable/delay.rb
|
175
|
+
- lib/rx_ruby/linq/observable/delay_with_selector.rb
|
176
|
+
- lib/rx_ruby/linq/observable/do.rb
|
177
|
+
- lib/rx_ruby/linq/observable/for.rb
|
178
|
+
- lib/rx_ruby/linq/observable/fork_join.rb
|
179
|
+
- lib/rx_ruby/linq/observable/from.rb
|
180
|
+
- lib/rx_ruby/linq/observable/group_join.rb
|
181
|
+
- lib/rx_ruby/linq/observable/if.rb
|
182
|
+
- lib/rx_ruby/linq/observable/interval.rb
|
183
|
+
- lib/rx_ruby/linq/observable/multicast.rb
|
184
|
+
- lib/rx_ruby/linq/observable/of.rb
|
185
|
+
- lib/rx_ruby/linq/observable/pairs.rb
|
186
|
+
- lib/rx_ruby/linq/observable/pluck.rb
|
187
|
+
- lib/rx_ruby/linq/observable/publish.rb
|
188
|
+
- lib/rx_ruby/linq/observable/start.rb
|
189
|
+
- lib/rx_ruby/linq/observable/time_interval.rb
|
190
|
+
- lib/rx_ruby/linq/observable/timer.rb
|
191
|
+
- lib/rx_ruby/linq/observable/timestamp.rb
|
192
|
+
- lib/rx_ruby/linq/observable/to_async.rb
|
193
|
+
- lib/rx_ruby/linq/observable/when.rb
|
194
|
+
- lib/rx_ruby/linq/observable/while.rb
|
195
|
+
- lib/rx_ruby/operators/aggregates.rb
|
196
|
+
- lib/rx_ruby/operators/creation.rb
|
197
|
+
- lib/rx_ruby/operators/multiple.rb
|
198
|
+
- lib/rx_ruby/operators/single.rb
|
199
|
+
- lib/rx_ruby/operators/standard_query_operators.rb
|
200
|
+
- lib/rx_ruby/operators/synchronization.rb
|
201
|
+
- lib/rx_ruby/operators/time.rb
|
202
|
+
- lib/rx_ruby/subjects/async_subject.rb
|
203
|
+
- lib/rx_ruby/subjects/behavior_subject.rb
|
204
|
+
- lib/rx_ruby/subjects/replay_subject.rb
|
205
|
+
- lib/rx_ruby/subjects/subject.rb
|
206
|
+
- lib/rx_ruby/subjects/subject_extensions.rb
|
207
|
+
- lib/rx_ruby/subscriptions/composite_subscription.rb
|
208
|
+
- lib/rx_ruby/subscriptions/ref_count_subscription.rb
|
209
|
+
- lib/rx_ruby/subscriptions/scheduled_subscription.rb
|
210
|
+
- lib/rx_ruby/subscriptions/serial_subscription.rb
|
211
|
+
- lib/rx_ruby/subscriptions/single_assignment_subscription.rb
|
212
|
+
- lib/rx_ruby/subscriptions/subscription.rb
|
213
|
+
- lib/rx_ruby/testing/cold_observable.rb
|
214
|
+
- lib/rx_ruby/testing/hot_observable.rb
|
215
|
+
- lib/rx_ruby/testing/mock_observer.rb
|
216
|
+
- lib/rx_ruby/testing/reactive_test.rb
|
217
|
+
- lib/rx_ruby/testing/recorded.rb
|
218
|
+
- lib/rx_ruby/testing/test_scheduler.rb
|
219
|
+
- lib/rx_ruby/testing/test_subscription.rb
|
220
|
+
- lib/rx_ruby/version.rb
|
221
|
+
- license.txt
|
222
|
+
- readme.md
|
223
|
+
- rx_ruby.gemspec
|
224
|
+
- test/rx_ruby/concurrency/helpers/historical_virtual_scheduler_helper.rb
|
225
|
+
- test/rx_ruby/concurrency/helpers/immediate_local_scheduler_helper.rb
|
226
|
+
- test/rx_ruby/concurrency/test_async_lock.rb
|
227
|
+
- test/rx_ruby/concurrency/test_current_thread_scheduler.rb
|
228
|
+
- test/rx_ruby/concurrency/test_default_scheduler.rb
|
229
|
+
- test/rx_ruby/concurrency/test_historical_scheduler.rb
|
230
|
+
- test/rx_ruby/concurrency/test_immediate_scheduler.rb
|
231
|
+
- test/rx_ruby/concurrency/test_local_scheduler.rb
|
232
|
+
- test/rx_ruby/concurrency/test_periodic_scheduler.rb
|
233
|
+
- test/rx_ruby/concurrency/test_scheduled_item.rb
|
234
|
+
- test/rx_ruby/concurrency/test_scheduler.rb
|
235
|
+
- test/rx_ruby/concurrency/test_virtual_time_scheduler.rb
|
236
|
+
- test/rx_ruby/core/test_notification.rb
|
237
|
+
- test/rx_ruby/core/test_observable_creation.rb
|
238
|
+
- test/rx_ruby/core/test_observer.rb
|
239
|
+
- test/rx_ruby/internal/test_priority_queue.rb
|
240
|
+
- test/rx_ruby/subscriptions/test_composite_subscription.rb
|
241
|
+
- test/rx_ruby/subscriptions/test_serial_subscription.rb
|
242
|
+
- test/rx_ruby/subscriptions/test_singleassignment_subscription.rb
|
243
|
+
- test/rx_ruby/subscriptions/test_subscription.rb
|
244
|
+
- test/test_helper.rb
|
245
|
+
homepage: https://github.com/ReactiveX/RxRuby
|
246
|
+
licenses:
|
247
|
+
- Apache License, v2.0
|
248
|
+
metadata: {}
|
249
|
+
post_install_message:
|
250
|
+
rdoc_options: []
|
251
|
+
require_paths:
|
252
|
+
- lib
|
253
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
|
+
requirements:
|
260
|
+
- - ">="
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: '0'
|
263
|
+
requirements: []
|
264
|
+
rubyforge_project:
|
265
|
+
rubygems_version: 2.4.6
|
266
|
+
signing_key:
|
267
|
+
specification_version: 4
|
268
|
+
summary: This is an implementation of the Reactive Extensions for Ruby. Note that
|
269
|
+
this is an early prototype, but contributions are welcome.
|
270
|
+
test_files:
|
271
|
+
- test/rx_ruby/concurrency/helpers/historical_virtual_scheduler_helper.rb
|
272
|
+
- test/rx_ruby/concurrency/helpers/immediate_local_scheduler_helper.rb
|
273
|
+
- test/rx_ruby/concurrency/test_async_lock.rb
|
274
|
+
- test/rx_ruby/concurrency/test_current_thread_scheduler.rb
|
275
|
+
- test/rx_ruby/concurrency/test_default_scheduler.rb
|
276
|
+
- test/rx_ruby/concurrency/test_historical_scheduler.rb
|
277
|
+
- test/rx_ruby/concurrency/test_immediate_scheduler.rb
|
278
|
+
- test/rx_ruby/concurrency/test_local_scheduler.rb
|
279
|
+
- test/rx_ruby/concurrency/test_periodic_scheduler.rb
|
280
|
+
- test/rx_ruby/concurrency/test_scheduled_item.rb
|
281
|
+
- test/rx_ruby/concurrency/test_scheduler.rb
|
282
|
+
- test/rx_ruby/concurrency/test_virtual_time_scheduler.rb
|
283
|
+
- test/rx_ruby/core/test_notification.rb
|
284
|
+
- test/rx_ruby/core/test_observable_creation.rb
|
285
|
+
- test/rx_ruby/core/test_observer.rb
|
286
|
+
- test/rx_ruby/internal/test_priority_queue.rb
|
287
|
+
- test/rx_ruby/subscriptions/test_composite_subscription.rb
|
288
|
+
- test/rx_ruby/subscriptions/test_serial_subscription.rb
|
289
|
+
- test/rx_ruby/subscriptions/test_singleassignment_subscription.rb
|
290
|
+
- test/rx_ruby/subscriptions/test_subscription.rb
|
291
|
+
- test/test_helper.rb
|