serializable_proc 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/HISTORY.txt +5 -1
  2. data/README.rdoc +6 -123
  3. data/Rakefile +4 -28
  4. data/VERSION +1 -1
  5. data/lib/serializable_proc/binding.rb +11 -15
  6. data/lib/serializable_proc/isolatable.rb +59 -42
  7. data/lib/serializable_proc.rb +15 -18
  8. data/serializable_proc.gemspec +12 -53
  9. data/spec/bounded_vars/errors_spec.rb +12 -4
  10. data/spec/bounded_vars/local_vars_within_block_scope_spec.rb +7 -7
  11. data/spec/code_block/magic_vars_spec.rb +1 -1
  12. data/spec/proc_like/invoking_with_args_spec.rb +6 -2
  13. data/spec/proc_like/others_spec.rb +15 -7
  14. data/spec/spec_helper.rb +6 -16
  15. metadata +47 -45
  16. data/lib/serializable_proc/parsers/dynamic.rb +0 -13
  17. data/lib/serializable_proc/parsers/static.rb +0 -103
  18. data/lib/serializable_proc/parsers.rb +0 -30
  19. data/spec/code_block/errors_spec.rb +0 -65
  20. data/spec/code_block/multiple_arities_spec.rb +0 -159
  21. data/spec/code_block/optional_arity_spec.rb +0 -160
  22. data/spec/code_block/single_arity_spec.rb +0 -159
  23. data/spec/code_block/zero_arity_spec.rb +0 -159
  24. data/spec/extending/new_matcher_w_multiple_arities_spec.rb +0 -152
  25. data/spec/extending/new_matcher_w_optional_arity_spec.rb +0 -152
  26. data/spec/extending/new_matcher_w_single_arity_spec.rb +0 -152
  27. data/spec/extending/new_matcher_w_zero_arity_spec.rb +0 -152
  28. data/spec/extending/spec_helper.rb +0 -23
  29. data/spec/extending/subclassing_w_multiple_arities_spec.rb +0 -74
  30. data/spec/extending/subclassing_w_optional_arity_spec.rb +0 -74
  31. data/spec/extending/subclassing_w_single_arity_spec.rb +0 -74
  32. data/spec/extending/subclassing_w_zero_arity_spec.rb +0 -74
@@ -1,152 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe 'Subclassing w optional arity' do
4
-
5
- expected_file = File.expand_path(__FILE__)
6
- expected_code = "lambda { |*lvar_args| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
7
-
8
- describe '>> wo args' do
9
-
10
- extend SerializableProc::Spec::Helpers
11
- behaves_like 'has support for parsing Otaky.work (wo args)'
12
-
13
- should "handle block using do ... end [##{__LINE__}]" do
14
- (
15
- Otaky.work do |*args|
16
- %w{a b}.map{|x| puts x }
17
- end
18
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
19
- end
20
-
21
- should "handle block using do ... end [##{__LINE__}]" do
22
- (Otaky.work do |*args| %w{a b}.map{|x| puts x } end).
23
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
24
- end
25
-
26
- should "handle block using { ... } [##{__LINE__}]" do
27
- (
28
- Otaky.work { |*args|
29
- %w{a b}.map{|x| puts x }
30
- }
31
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
32
- end
33
-
34
- should "handle block using { ... } [##{__LINE__}]" do
35
- (Otaky.work { |*args| %w{a b}.map{|x| puts x } }).
36
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
37
- end
38
-
39
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
40
- (Otaky.work(&(lambda { |*args| %w{a b}.map{|x| puts x } }))).
41
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
42
- end
43
-
44
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
45
- (
46
- Otaky.work(&(lambda do |*args|
47
- %w{a b}.map{|x| puts x }
48
- end))
49
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
50
- end
51
-
52
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
53
- (Otaky.work(&(proc { |*args| %w{a b}.map{|x| puts x } }))).
54
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
55
- end
56
-
57
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
58
- (
59
- Otaky.work(&(proc do |*args|
60
- %w{a b}.map{|x| puts x }
61
- end))
62
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
63
- end
64
-
65
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
66
- (Otaky.work(&(Proc.new { |*args| %w{a b}.map{|x| puts x } }))).
67
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
68
- end
69
-
70
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
71
- (
72
- Otaky.work(&(Proc.new do |*args|
73
- %w{a b}.map{|x| puts x }
74
- end))
75
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
76
- end
77
-
78
- end
79
-
80
- describe '>> w args' do
81
-
82
- extend SerializableProc::Spec::Helpers
83
- behaves_like 'has support for parsing Otaky.work (w args)'
84
-
85
- should "handle block using do ... end [##{__LINE__}]" do
86
- (
87
- Otaky.work(1, :a => 2, :b => 3) do |*args|
88
- %w{a b}.map{|x| puts x }
89
- end
90
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
91
- end
92
-
93
- should "handle block using do ... end [##{__LINE__}]" do
94
- (Otaky.work(1, :a => 2, :b => 3) do |*args| %w{a b}.map{|x| puts x } end).
95
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
96
- end
97
-
98
- should "handle block using { ... } [##{__LINE__}]" do
99
- (
100
- Otaky.work(1, :a => 2, :b => 3) { |*args|
101
- %w{a b}.map{|x| puts x }
102
- }
103
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
104
- end
105
-
106
- should "handle block using { ... } [##{__LINE__}]" do
107
- (Otaky.work(1, :a => 2, :b => 3) { |*args| %w{a b}.map{|x| puts x } }).
108
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
109
- end
110
-
111
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
112
- (Otaky.work(1, {:a => 2, :b => 3}, &(lambda { |*args| %w{a b}.map{|x| puts x } }))).
113
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
114
- end
115
-
116
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
117
- (
118
- Otaky.work(1, {:a => 2, :b => 3}, &(lambda do |*args|
119
- %w{a b}.map{|x| puts x }
120
- end))
121
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
122
- end
123
-
124
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
125
- (Otaky.work(1, {:a => 2, :b => 3}, &(proc { |*args| %w{a b}.map{|x| puts x } }))).
126
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
127
- end
128
-
129
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
130
- (
131
- Otaky.work(1, {:a => 2, :b => 3}, &(proc do |*args|
132
- %w{a b}.map{|x| puts x }
133
- end))
134
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
135
- end
136
-
137
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
138
- (Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new { |*args| %w{a b}.map{|x| puts x } }))).
139
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
140
- end
141
-
142
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
143
- (
144
- Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new do |*args|
145
- %w{a b}.map{|x| puts x }
146
- end))
147
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
148
- end
149
-
150
- end
151
-
152
- end
@@ -1,152 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe 'Subclassing w single arity' do
4
-
5
- expected_file = File.expand_path(__FILE__)
6
- expected_code = "lambda { |lvar_arg| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
7
-
8
- describe '>> wo args' do
9
-
10
- extend SerializableProc::Spec::Helpers
11
- behaves_like 'has support for parsing Otaky.work (wo args)'
12
-
13
- should "handle block using do ... end [##{__LINE__}]" do
14
- (
15
- Otaky.work do |arg|
16
- %w{a b}.map{|x| puts x }
17
- end
18
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
19
- end
20
-
21
- should "handle block using do ... end [##{__LINE__}]" do
22
- (Otaky.work do |arg| %w{a b}.map{|x| puts x } end).
23
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
24
- end
25
-
26
- should "handle block using { ... } [##{__LINE__}]" do
27
- (
28
- Otaky.work { |arg|
29
- %w{a b}.map{|x| puts x }
30
- }
31
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
32
- end
33
-
34
- should "handle block using { ... } [##{__LINE__}]" do
35
- (Otaky.work { |arg| %w{a b}.map{|x| puts x } }).
36
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
37
- end
38
-
39
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
40
- (Otaky.work(&(lambda { |arg| %w{a b}.map{|x| puts x } }))).
41
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
42
- end
43
-
44
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
45
- (
46
- Otaky.work(&(lambda do |arg|
47
- %w{a b}.map{|x| puts x }
48
- end))
49
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
50
- end
51
-
52
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
53
- (Otaky.work(&(proc { |arg| %w{a b}.map{|x| puts x } }))).
54
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
55
- end
56
-
57
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
58
- (
59
- Otaky.work(&(proc do |arg|
60
- %w{a b}.map{|x| puts x }
61
- end))
62
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
63
- end
64
-
65
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
66
- (Otaky.work(&(Proc.new { |arg| %w{a b}.map{|x| puts x } }))).
67
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
68
- end
69
-
70
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
71
- (
72
- Otaky.work(&(Proc.new do |arg|
73
- %w{a b}.map{|x| puts x }
74
- end))
75
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
76
- end
77
-
78
- end
79
-
80
- describe '>> w args' do
81
-
82
- extend SerializableProc::Spec::Helpers
83
- behaves_like 'has support for parsing Otaky.work (w args)'
84
-
85
- should "handle block using do ... end [##{__LINE__}]" do
86
- (
87
- Otaky.work(1, :a => 2, :b => 3) do |arg|
88
- %w{a b}.map{|x| puts x }
89
- end
90
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
91
- end
92
-
93
- should "handle block using do ... end [##{__LINE__}]" do
94
- (Otaky.work(1, :a => 2, :b => 3) do |arg| %w{a b}.map{|x| puts x } end).
95
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
96
- end
97
-
98
- should "handle block using { ... } [##{__LINE__}]" do
99
- (
100
- Otaky.work(1, :a => 2, :b => 3) { |arg|
101
- %w{a b}.map{|x| puts x }
102
- }
103
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
104
- end
105
-
106
- should "handle block using { ... } [##{__LINE__}]" do
107
- (Otaky.work(1, :a => 2, :b => 3) { |arg| %w{a b}.map{|x| puts x } }).
108
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
109
- end
110
-
111
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
112
- (Otaky.work(1, {:a => 2, :b => 3}, &(lambda { |arg| %w{a b}.map{|x| puts x } }))).
113
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
114
- end
115
-
116
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
117
- (
118
- Otaky.work(1, {:a => 2, :b => 3}, &(lambda do |arg|
119
- %w{a b}.map{|x| puts x }
120
- end))
121
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
122
- end
123
-
124
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
125
- (Otaky.work(1, {:a => 2, :b => 3}, &(proc { |arg| %w{a b}.map{|x| puts x } }))).
126
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
127
- end
128
-
129
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
130
- (
131
- Otaky.work(1, {:a => 2, :b => 3}, &(proc do |arg|
132
- %w{a b}.map{|x| puts x }
133
- end))
134
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
135
- end
136
-
137
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
138
- (Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new { |arg| %w{a b}.map{|x| puts x } }))).
139
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
140
- end
141
-
142
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
143
- (
144
- Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new do |arg|
145
- %w{a b}.map{|x| puts x }
146
- end))
147
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
148
- end
149
-
150
- end
151
-
152
- end
@@ -1,152 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe 'Subclassing w zero arity' do
4
-
5
- expected_file = File.expand_path(__FILE__)
6
- expected_code = "lambda { [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
7
-
8
- describe '>> wo args' do
9
-
10
- extend SerializableProc::Spec::Helpers
11
- behaves_like 'has support for parsing Otaky.work (wo args)'
12
-
13
- should "handle block using do ... end [##{__LINE__}]" do
14
- (
15
- Otaky.work do
16
- %w{a b}.map{|x| puts x }
17
- end
18
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
19
- end
20
-
21
- should "handle block using do ... end [##{__LINE__}]" do
22
- (Otaky.work do %w{a b}.map{|x| puts x } end).
23
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
24
- end
25
-
26
- should "handle block using { ... } [##{__LINE__}]" do
27
- (
28
- Otaky.work {
29
- %w{a b}.map{|x| puts x }
30
- }
31
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
32
- end
33
-
34
- should "handle block using { ... } [##{__LINE__}]" do
35
- (Otaky.work { %w{a b}.map{|x| puts x } }).
36
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
37
- end
38
-
39
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
40
- (Otaky.work(&(lambda { %w{a b}.map{|x| puts x } }))).
41
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
42
- end
43
-
44
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
45
- (
46
- Otaky.work(&(lambda do
47
- %w{a b}.map{|x| puts x }
48
- end))
49
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
50
- end
51
-
52
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
53
- (Otaky.work(&(proc { %w{a b}.map{|x| puts x } }))).
54
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
55
- end
56
-
57
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
58
- (
59
- Otaky.work(&(proc do
60
- %w{a b}.map{|x| puts x }
61
- end))
62
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
63
- end
64
-
65
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
66
- (Otaky.work(&(Proc.new { %w{a b}.map{|x| puts x } }))).
67
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
68
- end
69
-
70
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
71
- (
72
- Otaky.work(&(Proc.new do
73
- %w{a b}.map{|x| puts x }
74
- end))
75
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
76
- end
77
-
78
- end
79
-
80
- describe '>> w args' do
81
-
82
- extend SerializableProc::Spec::Helpers
83
- behaves_like 'has support for parsing Otaky.work (w args)'
84
-
85
- should "handle block using do ... end [##{__LINE__}]" do
86
- (
87
- Otaky.work(1, :a => 2, :b => 3) do
88
- %w{a b}.map{|x| puts x }
89
- end
90
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
91
- end
92
-
93
- should "handle block using do ... end [##{__LINE__}]" do
94
- (Otaky.work(1, :a => 2, :b => 3) do %w{a b}.map{|x| puts x } end).
95
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
96
- end
97
-
98
- should "handle block using { ... } [##{__LINE__}]" do
99
- (
100
- Otaky.work(1, :a => 2, :b => 3) {
101
- %w{a b}.map{|x| puts x }
102
- }
103
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
104
- end
105
-
106
- should "handle block using { ... } [##{__LINE__}]" do
107
- (Otaky.work(1, :a => 2, :b => 3) { %w{a b}.map{|x| puts x } }).
108
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
109
- end
110
-
111
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
112
- (Otaky.work(1, {:a => 2, :b => 3}, &(lambda { %w{a b}.map{|x| puts x } }))).
113
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
114
- end
115
-
116
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
117
- (
118
- Otaky.work(1, {:a => 2, :b => 3}, &(lambda do
119
- %w{a b}.map{|x| puts x }
120
- end))
121
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
122
- end
123
-
124
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
125
- (Otaky.work(1, {:a => 2, :b => 3}, &(proc { %w{a b}.map{|x| puts x } }))).
126
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
127
- end
128
-
129
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
130
- (
131
- Otaky.work(1, {:a => 2, :b => 3}, &(proc do
132
- %w{a b}.map{|x| puts x }
133
- end))
134
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
135
- end
136
-
137
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
138
- (Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new { %w{a b}.map{|x| puts x } }))).
139
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
140
- end
141
-
142
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
143
- (
144
- Otaky.work(1, {:a => 2, :b => 3}, &(Proc.new do
145
- %w{a b}.map{|x| puts x }
146
- end))
147
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
148
- end
149
-
150
- end
151
-
152
- end
@@ -1,23 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
-
3
- class Otaky
4
-
5
- class MagicProc < ::SerializableProc ; end
6
-
7
- class << self
8
- def work(*args, &block)
9
- SerializableProc.new(&block)
10
- end
11
- end
12
-
13
- end
14
-
15
- shared 'has support for parsing Otaky.work (wo args)' do
16
- before { SerializableProc::Parsers::Static.matchers << 'Otaky\.work' }
17
- after { SerializableProc::Parsers::Static.matchers.clear }
18
- end
19
-
20
- shared 'has support for parsing Otaky.work (w args)' do
21
- before { SerializableProc::Parsers::Static.matchers << 'Otaky\.work\W.*?\W' }
22
- after { SerializableProc::Parsers::Static.matchers.clear }
23
- end
@@ -1,74 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe 'Subclassing w multiple arities' do
4
-
5
- extend SerializableProc::Spec::Helpers
6
- expected_file = File.expand_path(__FILE__)
7
- expected_code = "lambda { |lvar_arg1, lvar_arg2| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
8
-
9
- should "handle block using do ... end [##{__LINE__}]" do
10
- (
11
- Otaky::MagicProc.new do |arg1, arg2|
12
- %w{a b}.map{|x| puts x }
13
- end
14
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
15
- end
16
-
17
- should "handle block using do ... end [##{__LINE__}]" do
18
- (Otaky::MagicProc.new do |arg1, arg2| %w{a b}.map{|x| puts x } end).
19
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
20
- end
21
-
22
- should "handle block using { ... } [##{__LINE__}]" do
23
- (
24
- Otaky::MagicProc.new { |arg1, arg2|
25
- %w{a b}.map{|x| puts x }
26
- }
27
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
28
- end
29
-
30
- should "handle block using { ... } [##{__LINE__}]" do
31
- (Otaky::MagicProc.new { |arg1, arg2| %w{a b}.map{|x| puts x } }).
32
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
33
- end
34
-
35
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
36
- (Otaky::MagicProc.new(&(lambda { |arg1, arg2| %w{a b}.map{|x| puts x } }))).
37
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
38
- end
39
-
40
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
41
- (
42
- Otaky::MagicProc.new(&(lambda do |arg1, arg2|
43
- %w{a b}.map{|x| puts x }
44
- end))
45
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
46
- end
47
-
48
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
49
- (Otaky::MagicProc.new(&(proc { |arg1, arg2| %w{a b}.map{|x| puts x } }))).
50
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
51
- end
52
-
53
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
54
- (
55
- Otaky::MagicProc.new(&(proc do |arg1, arg2|
56
- %w{a b}.map{|x| puts x }
57
- end))
58
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
59
- end
60
-
61
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
62
- (Otaky::MagicProc.new(&(Proc.new { |arg1, arg2| %w{a b}.map{|x| puts x } }))).
63
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
64
- end
65
-
66
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
67
- (
68
- Otaky::MagicProc.new(&(Proc.new do |arg1, arg2|
69
- %w{a b}.map{|x| puts x }
70
- end))
71
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
72
- end
73
-
74
- end
@@ -1,74 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe 'Subclassing w optional arity' do
4
-
5
- extend SerializableProc::Spec::Helpers
6
- expected_file = File.expand_path(__FILE__)
7
- expected_code = "lambda { |*lvar_args| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
8
-
9
- should "handle block using do ... end [##{__LINE__}]" do
10
- (
11
- Otaky::MagicProc.new do |*args|
12
- %w{a b}.map{|x| puts x }
13
- end
14
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
15
- end
16
-
17
- should "handle block using do ... end [##{__LINE__}]" do
18
- (Otaky::MagicProc.new do |*args| %w{a b}.map{|x| puts x } end).
19
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
20
- end
21
-
22
- should "handle block using { ... } [##{__LINE__}]" do
23
- (
24
- Otaky::MagicProc.new { |*args|
25
- %w{a b}.map{|x| puts x }
26
- }
27
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
28
- end
29
-
30
- should "handle block using { ... } [##{__LINE__}]" do
31
- (Otaky::MagicProc.new { |*args| %w{a b}.map{|x| puts x } }).
32
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
33
- end
34
-
35
- should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
36
- (Otaky::MagicProc.new(&(lambda { |*args| %w{a b}.map{|x| puts x } }))).
37
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
38
- end
39
-
40
- should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
41
- (
42
- Otaky::MagicProc.new(&(lambda do |*args|
43
- %w{a b}.map{|x| puts x }
44
- end))
45
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
46
- end
47
-
48
- should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
49
- (Otaky::MagicProc.new(&(proc { |*args| %w{a b}.map{|x| puts x } }))).
50
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
51
- end
52
-
53
- should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
54
- (
55
- Otaky::MagicProc.new(&(proc do |*args|
56
- %w{a b}.map{|x| puts x }
57
- end))
58
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
59
- end
60
-
61
- should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
62
- (Otaky::MagicProc.new(&(Proc.new { |*args| %w{a b}.map{|x| puts x } }))).
63
- should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
64
- end
65
-
66
- should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
67
- (
68
- Otaky::MagicProc.new(&(Proc.new do |*args|
69
- %w{a b}.map{|x| puts x }
70
- end))
71
- ).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
72
- end
73
-
74
- end