serializable_proc 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.txt +5 -1
- data/README.rdoc +6 -123
- data/Rakefile +4 -28
- data/VERSION +1 -1
- data/lib/serializable_proc/binding.rb +11 -15
- data/lib/serializable_proc/isolatable.rb +59 -42
- data/lib/serializable_proc.rb +15 -18
- data/serializable_proc.gemspec +12 -53
- data/spec/bounded_vars/errors_spec.rb +12 -4
- data/spec/bounded_vars/local_vars_within_block_scope_spec.rb +7 -7
- data/spec/code_block/magic_vars_spec.rb +1 -1
- data/spec/proc_like/invoking_with_args_spec.rb +6 -2
- data/spec/proc_like/others_spec.rb +15 -7
- data/spec/spec_helper.rb +6 -16
- metadata +47 -45
- data/lib/serializable_proc/parsers/dynamic.rb +0 -13
- data/lib/serializable_proc/parsers/static.rb +0 -103
- data/lib/serializable_proc/parsers.rb +0 -30
- data/spec/code_block/errors_spec.rb +0 -65
- data/spec/code_block/multiple_arities_spec.rb +0 -159
- data/spec/code_block/optional_arity_spec.rb +0 -160
- data/spec/code_block/single_arity_spec.rb +0 -159
- data/spec/code_block/zero_arity_spec.rb +0 -159
- data/spec/extending/new_matcher_w_multiple_arities_spec.rb +0 -152
- data/spec/extending/new_matcher_w_optional_arity_spec.rb +0 -152
- data/spec/extending/new_matcher_w_single_arity_spec.rb +0 -152
- data/spec/extending/new_matcher_w_zero_arity_spec.rb +0 -152
- data/spec/extending/spec_helper.rb +0 -23
- data/spec/extending/subclassing_w_multiple_arities_spec.rb +0 -74
- data/spec/extending/subclassing_w_optional_arity_spec.rb +0 -74
- data/spec/extending/subclassing_w_single_arity_spec.rb +0 -74
- data/spec/extending/subclassing_w_zero_arity_spec.rb +0 -74
@@ -1,160 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
-
|
3
|
-
describe 'Extracting optional arity code block' do
|
4
|
-
|
5
|
-
extend SerializableProc::Spec::Helpers
|
6
|
-
|
7
|
-
expected_file = File.expand_path(__FILE__)
|
8
|
-
expected_code = "lambda { |*lvar_args| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
|
9
|
-
|
10
|
-
should_handle_proc_variable expected_file, expected_code, {
|
11
|
-
# ////////////////////////////////////////////////////////////////////////
|
12
|
-
# >> Always newlinling
|
13
|
-
# ////////////////////////////////////////////////////////////////////////
|
14
|
-
__LINE__ =>
|
15
|
-
lambda do |*args|
|
16
|
-
%w{a b}.map do |x|
|
17
|
-
puts x
|
18
|
-
end
|
19
|
-
end,
|
20
|
-
__LINE__ =>
|
21
|
-
lambda { |*args|
|
22
|
-
%w{a b}.map{|x|
|
23
|
-
puts x
|
24
|
-
}
|
25
|
-
},
|
26
|
-
__LINE__ =>
|
27
|
-
proc do |*args|
|
28
|
-
%w{a b}.map do |x|
|
29
|
-
puts x
|
30
|
-
end
|
31
|
-
end,
|
32
|
-
__LINE__ =>
|
33
|
-
lambda { |*args|
|
34
|
-
%w{a b}.map{|x|
|
35
|
-
puts x
|
36
|
-
}
|
37
|
-
},
|
38
|
-
__LINE__ =>
|
39
|
-
Proc.new do |*args|
|
40
|
-
%w{a b}.map do |x|
|
41
|
-
puts x
|
42
|
-
end
|
43
|
-
end,
|
44
|
-
__LINE__ =>
|
45
|
-
Proc.new { |*args|
|
46
|
-
%w{a b}.map{|x|
|
47
|
-
puts x
|
48
|
-
}
|
49
|
-
},
|
50
|
-
# ////////////////////////////////////////////////////////////////////////
|
51
|
-
# >> Partial newlining
|
52
|
-
# ////////////////////////////////////////////////////////////////////////
|
53
|
-
__LINE__ =>
|
54
|
-
lambda do |*args|
|
55
|
-
%w{a b}.map do |x| puts x end
|
56
|
-
end,
|
57
|
-
__LINE__ =>
|
58
|
-
lambda { |*args|
|
59
|
-
%w{a b}.map{|x| puts x }
|
60
|
-
},
|
61
|
-
__LINE__ =>
|
62
|
-
proc do |*args|
|
63
|
-
%w{a b}.map do |x| puts x end
|
64
|
-
end,
|
65
|
-
__LINE__ =>
|
66
|
-
lambda { |*args|
|
67
|
-
%w{a b}.map{|x| puts x }
|
68
|
-
},
|
69
|
-
__LINE__ =>
|
70
|
-
Proc.new do |*args|
|
71
|
-
%w{a b}.map do |x| puts x end
|
72
|
-
end,
|
73
|
-
__LINE__ =>
|
74
|
-
Proc.new { |*args|
|
75
|
-
%w{a b}.map{|x| puts x }
|
76
|
-
},
|
77
|
-
# ////////////////////////////////////////////////////////////////////////
|
78
|
-
# >> No newlining
|
79
|
-
# ////////////////////////////////////////////////////////////////////////
|
80
|
-
__LINE__ =>
|
81
|
-
lambda do |*args| %w{a b}.map do |x| puts x end end,
|
82
|
-
__LINE__ =>
|
83
|
-
lambda { |*args| %w{a b}.map{|x| puts x } },
|
84
|
-
__LINE__ =>
|
85
|
-
proc do |*args| %w{a b}.map do |x| puts x end end,
|
86
|
-
__LINE__ =>
|
87
|
-
lambda { |*args| %w{a b}.map{|x| puts x } },
|
88
|
-
__LINE__ =>
|
89
|
-
Proc.new do |*args| %w{a b}.map do |x| puts x end end,
|
90
|
-
__LINE__ =>
|
91
|
-
Proc.new { |*args| %w{a b}.map{|x| puts x } },
|
92
|
-
}
|
93
|
-
|
94
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
95
|
-
(
|
96
|
-
SerializableProc.new do |*args|
|
97
|
-
%w{a b}.map{|x| puts x }
|
98
|
-
end
|
99
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
100
|
-
end
|
101
|
-
|
102
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
103
|
-
(SerializableProc.new do |*args| %w{a b}.map{|x| puts x } end).
|
104
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
105
|
-
end
|
106
|
-
|
107
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
108
|
-
(
|
109
|
-
SerializableProc.new { |*args|
|
110
|
-
%w{a b}.map{|x| puts x }
|
111
|
-
}
|
112
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
113
|
-
end
|
114
|
-
|
115
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
116
|
-
(SerializableProc.new { |*args| %w{a b}.map{|x| puts x } }).
|
117
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
118
|
-
end
|
119
|
-
|
120
|
-
should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
|
121
|
-
(SerializableProc.new(&(lambda { |*args| %w{a b}.map{|x| puts x } }))).
|
122
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
123
|
-
end
|
124
|
-
|
125
|
-
should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
|
126
|
-
(
|
127
|
-
SerializableProc.new(&(lambda do |*args|
|
128
|
-
%w{a b}.map{|x| puts x }
|
129
|
-
end))
|
130
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
131
|
-
end
|
132
|
-
|
133
|
-
should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
|
134
|
-
(SerializableProc.new(&(proc { |*args| %w{a b}.map{|x| puts x } }))).
|
135
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
136
|
-
end
|
137
|
-
|
138
|
-
should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
|
139
|
-
(
|
140
|
-
SerializableProc.new(&(proc do |*args|
|
141
|
-
%w{a b}.map{|x| puts x }
|
142
|
-
end))
|
143
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
144
|
-
end
|
145
|
-
|
146
|
-
should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
|
147
|
-
(SerializableProc.new(&(Proc.new { |*args| %w{a b}.map{|x| puts x } }))).
|
148
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
149
|
-
end
|
150
|
-
|
151
|
-
should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
|
152
|
-
(
|
153
|
-
SerializableProc.new(&(Proc.new do |*args|
|
154
|
-
%w{a b}.map{|x| puts x }
|
155
|
-
end))
|
156
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
end
|
@@ -1,159 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
-
|
3
|
-
describe 'Extracting single arity code block' do
|
4
|
-
|
5
|
-
extend SerializableProc::Spec::Helpers
|
6
|
-
|
7
|
-
expected_file = File.expand_path(__FILE__)
|
8
|
-
expected_code = "lambda { |lvar_arg| [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
|
9
|
-
|
10
|
-
should_handle_proc_variable expected_file, expected_code, {
|
11
|
-
# ////////////////////////////////////////////////////////////////////////
|
12
|
-
# >> Always newlinling
|
13
|
-
# ////////////////////////////////////////////////////////////////////////
|
14
|
-
__LINE__ =>
|
15
|
-
lambda do |arg|
|
16
|
-
%w{a b}.map do |x|
|
17
|
-
puts x
|
18
|
-
end
|
19
|
-
end,
|
20
|
-
__LINE__ =>
|
21
|
-
lambda { |arg|
|
22
|
-
%w{a b}.map{|x|
|
23
|
-
puts x
|
24
|
-
}
|
25
|
-
},
|
26
|
-
__LINE__ =>
|
27
|
-
proc do |arg|
|
28
|
-
%w{a b}.map do |x|
|
29
|
-
puts x
|
30
|
-
end
|
31
|
-
end,
|
32
|
-
__LINE__ =>
|
33
|
-
lambda { |arg|
|
34
|
-
%w{a b}.map{|x|
|
35
|
-
puts x
|
36
|
-
}
|
37
|
-
},
|
38
|
-
__LINE__ =>
|
39
|
-
Proc.new do |arg|
|
40
|
-
%w{a b}.map do |x|
|
41
|
-
puts x
|
42
|
-
end
|
43
|
-
end,
|
44
|
-
__LINE__ =>
|
45
|
-
Proc.new { |arg|
|
46
|
-
%w{a b}.map{|x|
|
47
|
-
puts x
|
48
|
-
}
|
49
|
-
},
|
50
|
-
# ////////////////////////////////////////////////////////////////////////
|
51
|
-
# >> Partial newlining
|
52
|
-
# ////////////////////////////////////////////////////////////////////////
|
53
|
-
__LINE__ =>
|
54
|
-
lambda do |arg|
|
55
|
-
%w{a b}.map do |x| puts x end
|
56
|
-
end,
|
57
|
-
__LINE__ =>
|
58
|
-
lambda { |arg|
|
59
|
-
%w{a b}.map{|x| puts x }
|
60
|
-
},
|
61
|
-
__LINE__ =>
|
62
|
-
proc do |arg|
|
63
|
-
%w{a b}.map do |x| puts x end
|
64
|
-
end,
|
65
|
-
__LINE__ =>
|
66
|
-
lambda { |arg|
|
67
|
-
%w{a b}.map{|x| puts x }
|
68
|
-
},
|
69
|
-
__LINE__ =>
|
70
|
-
Proc.new do |arg|
|
71
|
-
%w{a b}.map do |x| puts x end
|
72
|
-
end,
|
73
|
-
__LINE__ =>
|
74
|
-
Proc.new { |arg|
|
75
|
-
%w{a b}.map{|x| puts x }
|
76
|
-
},
|
77
|
-
# ////////////////////////////////////////////////////////////////////////
|
78
|
-
# >> No newlining
|
79
|
-
# ////////////////////////////////////////////////////////////////////////
|
80
|
-
__LINE__ =>
|
81
|
-
lambda do |arg| %w{a b}.map do |x| puts x end end,
|
82
|
-
__LINE__ =>
|
83
|
-
lambda { |arg| %w{a b}.map{|x| puts x } },
|
84
|
-
__LINE__ =>
|
85
|
-
proc do |arg| %w{a b}.map do |x| puts x end end,
|
86
|
-
__LINE__ =>
|
87
|
-
lambda { |arg| %w{a b}.map{|x| puts x } },
|
88
|
-
__LINE__ =>
|
89
|
-
Proc.new do |arg| %w{a b}.map do |x| puts x end end,
|
90
|
-
__LINE__ =>
|
91
|
-
Proc.new { |arg| %w{a b}.map{|x| puts x } },
|
92
|
-
}
|
93
|
-
|
94
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
95
|
-
(
|
96
|
-
SerializableProc.new do |arg|
|
97
|
-
%w{a b}.map{|x| puts x }
|
98
|
-
end
|
99
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
100
|
-
end
|
101
|
-
|
102
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
103
|
-
(SerializableProc.new do |arg| %w{a b}.map{|x| puts x } end).
|
104
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
105
|
-
end
|
106
|
-
|
107
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
108
|
-
(
|
109
|
-
SerializableProc.new { |arg|
|
110
|
-
%w{a b}.map{|x| puts x }
|
111
|
-
}
|
112
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
113
|
-
end
|
114
|
-
|
115
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
116
|
-
(SerializableProc.new { |arg| %w{a b}.map{|x| puts x } }).
|
117
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
118
|
-
end
|
119
|
-
|
120
|
-
should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
|
121
|
-
(SerializableProc.new(&(lambda { |arg| %w{a b}.map{|x| puts x } }))).
|
122
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
123
|
-
end
|
124
|
-
|
125
|
-
should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
|
126
|
-
(
|
127
|
-
SerializableProc.new(&(lambda do |arg|
|
128
|
-
%w{a b}.map{|x| puts x }
|
129
|
-
end))
|
130
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
131
|
-
end
|
132
|
-
|
133
|
-
should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
|
134
|
-
(SerializableProc.new(&(proc { |arg| %w{a b}.map{|x| puts x } }))).
|
135
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
136
|
-
end
|
137
|
-
|
138
|
-
should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
|
139
|
-
(
|
140
|
-
SerializableProc.new(&(proc do |arg|
|
141
|
-
%w{a b}.map{|x| puts x }
|
142
|
-
end))
|
143
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
144
|
-
end
|
145
|
-
|
146
|
-
should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
|
147
|
-
(SerializableProc.new(&(Proc.new { |arg| %w{a b}.map{|x| puts x } }))).
|
148
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
149
|
-
end
|
150
|
-
|
151
|
-
should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
|
152
|
-
(
|
153
|
-
SerializableProc.new(&(Proc.new do |arg|
|
154
|
-
%w{a b}.map{|x| puts x }
|
155
|
-
end))
|
156
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
157
|
-
end
|
158
|
-
|
159
|
-
end
|
@@ -1,159 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
-
|
3
|
-
describe 'Extracting zero arity code block' do
|
4
|
-
|
5
|
-
extend SerializableProc::Spec::Helpers
|
6
|
-
|
7
|
-
expected_file = File.expand_path(__FILE__)
|
8
|
-
expected_code = "lambda { [\"a\", \"b\"].map { |lvar_x| puts(lvar_x) } }"
|
9
|
-
|
10
|
-
should_handle_proc_variable expected_file, expected_code, {
|
11
|
-
# ////////////////////////////////////////////////////////////////////////
|
12
|
-
# >> Always newlinling
|
13
|
-
# ////////////////////////////////////////////////////////////////////////
|
14
|
-
__LINE__ =>
|
15
|
-
lambda do
|
16
|
-
%w{a b}.map do |x|
|
17
|
-
puts x
|
18
|
-
end
|
19
|
-
end,
|
20
|
-
__LINE__ =>
|
21
|
-
lambda {
|
22
|
-
%w{a b}.map{|x|
|
23
|
-
puts x
|
24
|
-
}
|
25
|
-
},
|
26
|
-
__LINE__ =>
|
27
|
-
proc do
|
28
|
-
%w{a b}.map do |x|
|
29
|
-
puts x
|
30
|
-
end
|
31
|
-
end,
|
32
|
-
__LINE__ =>
|
33
|
-
lambda {
|
34
|
-
%w{a b}.map{|x|
|
35
|
-
puts x
|
36
|
-
}
|
37
|
-
},
|
38
|
-
__LINE__ =>
|
39
|
-
Proc.new do
|
40
|
-
%w{a b}.map do |x|
|
41
|
-
puts x
|
42
|
-
end
|
43
|
-
end,
|
44
|
-
__LINE__ =>
|
45
|
-
Proc.new {
|
46
|
-
%w{a b}.map{|x|
|
47
|
-
puts x
|
48
|
-
}
|
49
|
-
},
|
50
|
-
# ////////////////////////////////////////////////////////////////////////
|
51
|
-
# >> Partial newlining
|
52
|
-
# ////////////////////////////////////////////////////////////////////////
|
53
|
-
__LINE__ =>
|
54
|
-
lambda do
|
55
|
-
%w{a b}.map do |x| puts x end
|
56
|
-
end,
|
57
|
-
__LINE__ =>
|
58
|
-
lambda {
|
59
|
-
%w{a b}.map{|x| puts x }
|
60
|
-
},
|
61
|
-
__LINE__ =>
|
62
|
-
proc do
|
63
|
-
%w{a b}.map do |x| puts x end
|
64
|
-
end,
|
65
|
-
__LINE__ =>
|
66
|
-
lambda {
|
67
|
-
%w{a b}.map{|x| puts x }
|
68
|
-
},
|
69
|
-
__LINE__ =>
|
70
|
-
Proc.new do
|
71
|
-
%w{a b}.map do |x| puts x end
|
72
|
-
end,
|
73
|
-
__LINE__ =>
|
74
|
-
Proc.new {
|
75
|
-
%w{a b}.map{|x| puts x }
|
76
|
-
},
|
77
|
-
# ////////////////////////////////////////////////////////////////////////
|
78
|
-
# >> No newlining
|
79
|
-
# ////////////////////////////////////////////////////////////////////////
|
80
|
-
__LINE__ =>
|
81
|
-
lambda do %w{a b}.map do |x| puts x end end,
|
82
|
-
__LINE__ =>
|
83
|
-
lambda { %w{a b}.map{|x| puts x } },
|
84
|
-
__LINE__ =>
|
85
|
-
proc do %w{a b}.map do |x| puts x end end,
|
86
|
-
__LINE__ =>
|
87
|
-
lambda { %w{a b}.map{|x| puts x } },
|
88
|
-
__LINE__ =>
|
89
|
-
Proc.new do %w{a b}.map do |x| puts x end end,
|
90
|
-
__LINE__ =>
|
91
|
-
Proc.new { %w{a b}.map{|x| puts x } },
|
92
|
-
}
|
93
|
-
|
94
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
95
|
-
(
|
96
|
-
SerializableProc.new do
|
97
|
-
%w{a b}.map{|x| puts x }
|
98
|
-
end
|
99
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
100
|
-
end
|
101
|
-
|
102
|
-
should "handle block using do ... end [##{__LINE__}]" do
|
103
|
-
(SerializableProc.new do %w{a b}.map{|x| puts x } end).
|
104
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
105
|
-
end
|
106
|
-
|
107
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
108
|
-
(
|
109
|
-
SerializableProc.new {
|
110
|
-
%w{a b}.map{|x| puts x }
|
111
|
-
}
|
112
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
113
|
-
end
|
114
|
-
|
115
|
-
should "handle block using { ... } [##{__LINE__}]" do
|
116
|
-
(SerializableProc.new { %w{a b}.map{|x| puts x } }).
|
117
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
118
|
-
end
|
119
|
-
|
120
|
-
should "handle fanciful initializing with lambda { ... } [##{__LINE__}]" do
|
121
|
-
(SerializableProc.new(&(lambda { %w{a b}.map{|x| puts x } }))).
|
122
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
123
|
-
end
|
124
|
-
|
125
|
-
should "handle fanciful initializing with lambda do ... end [##{__LINE__}]" do
|
126
|
-
(
|
127
|
-
SerializableProc.new(&(lambda do
|
128
|
-
%w{a b}.map{|x| puts x }
|
129
|
-
end))
|
130
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
131
|
-
end
|
132
|
-
|
133
|
-
should "handle fanciful initializing with proc { ... } [##{__LINE__}]" do
|
134
|
-
(SerializableProc.new(&(proc { %w{a b}.map{|x| puts x } }))).
|
135
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
136
|
-
end
|
137
|
-
|
138
|
-
should "handle fanciful initializing with proc do ... end [##{__LINE__}]" do
|
139
|
-
(
|
140
|
-
SerializableProc.new(&(proc do
|
141
|
-
%w{a b}.map{|x| puts x }
|
142
|
-
end))
|
143
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
144
|
-
end
|
145
|
-
|
146
|
-
should "handle fanciful initializing with Proc.new { ... } [##{__LINE__}]" do
|
147
|
-
(SerializableProc.new(&(Proc.new { %w{a b}.map{|x| puts x } }))).
|
148
|
-
should.be having_expected_proc_attrs(expected_file, __LINE__.pred, expected_code)
|
149
|
-
end
|
150
|
-
|
151
|
-
should "handle fanciful initializing with Proc.new do ... end [##{__LINE__}]" do
|
152
|
-
(
|
153
|
-
SerializableProc.new(&(Proc.new do
|
154
|
-
%w{a b}.map{|x| puts x }
|
155
|
-
end))
|
156
|
-
).should.be having_expected_proc_attrs(expected_file, __LINE__ - 3, expected_code)
|
157
|
-
end
|
158
|
-
|
159
|
-
end
|
@@ -1,152 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
|
3
|
-
describe 'New matcher w multiple arities' do
|
4
|
-
|
5
|
-
expected_file = File.expand_path(__FILE__)
|
6
|
-
expected_code = "lambda { |lvar_arg1, lvar_arg2| [\"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 |arg1, arg2|
|
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 |arg1, arg2| %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 { |arg1, arg2|
|
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 { |arg1, arg2| %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 { |arg1, arg2| %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 |arg1, arg2|
|
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 { |arg1, arg2| %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 |arg1, arg2|
|
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 { |arg1, arg2| %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 |arg1, arg2|
|
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 |arg1, arg2|
|
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 |arg1, arg2| %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) { |arg1, arg2|
|
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) { |arg1, arg2| %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 { |arg1, arg2| %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 |arg1, arg2|
|
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 { |arg1, arg2| %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 |arg1, arg2|
|
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 { |arg1, arg2| %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 |arg1, arg2|
|
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
|