rubinius-melbourne 2.0.1.0 → 2.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -9
- data/Gemfile +0 -4
- data/Rakefile +26 -19
- data/ext/rubinius/melbourne/extconf.rb +4 -3
- data/ext/rubinius/melbourne/grammar.cpp +2 -2
- data/ext/rubinius/melbourne/grammar.y +2 -2
- data/ext/rubinius/melbourne/melbourne.cpp +4 -5
- data/lib/rubinius/melbourne/version.rb +2 -2
- data/lib/rubinius/melbourne.rb +1 -21
- data/rubinius-melbourne.gemspec +6 -3
- data/spec/alias_spec.rb +13 -18
- data/spec/and_spec.rb +6 -12
- data/spec/array_spec.rb +28 -54
- data/spec/attrasgn_spec.rb +60 -85
- data/spec/back_ref_spec.rb +6 -8
- data/spec/call_spec.rb +137 -225
- data/spec/case_spec.rb +94 -112
- data/spec/cdecl_spec.rb +16 -28
- data/spec/class_spec.rb +28 -40
- data/spec/colon2_spec.rb +2 -4
- data/spec/colon3_spec.rb +2 -4
- data/spec/const_spec.rb +2 -4
- data/spec/custom/runner/relates.rb +4 -0
- data/spec/cvar_spec.rb +6 -12
- data/spec/cvasgn_spec.rb +20 -15
- data/spec/defined_spec.rb +57 -55
- data/spec/defn_spec.rb +218 -280
- data/spec/defs_spec.rb +30 -38
- data/spec/dot2_spec.rb +2 -4
- data/spec/dot3_spec.rb +2 -4
- data/spec/dregx_spec.rb +20 -34
- data/spec/dstr_spec.rb +87 -111
- data/spec/dsym_spec.rb +5 -7
- data/spec/dxstr_spec.rb +2 -4
- data/spec/ensure_spec.rb +32 -40
- data/spec/false_spec.rb +2 -4
- data/spec/flip2_spec.rb +22 -26
- data/spec/flip3_spec.rb +15 -17
- data/spec/for_spec.rb +25 -23
- data/spec/gasgn_spec.rb +4 -8
- data/spec/gvar_spec.rb +8 -16
- data/spec/hash_spec.rb +14 -18
- data/spec/iasgn_spec.rb +8 -14
- data/spec/if_spec.rb +50 -80
- data/spec/iter_spec.rb +328 -402
- data/spec/lasgn_spec.rb +143 -200
- data/spec/lit_spec.rb +20 -40
- data/spec/masgn_spec.rb +278 -309
- data/spec/match2_spec.rb +6 -10
- data/spec/match3_spec.rb +9 -13
- data/spec/match_spec.rb +2 -4
- data/spec/module_spec.rb +12 -16
- data/spec/nil_spec.rb +2 -4
- data/spec/not_spec.rb +6 -8
- data/spec/nth_ref_spec.rb +2 -4
- data/spec/op_asgn_spec.rb +118 -158
- data/spec/or_spec.rb +18 -24
- data/spec/postexe_spec.rb +2 -4
- data/spec/regex_spec.rb +11 -19
- data/spec/rescue_spec.rb +135 -143
- data/spec/return_spec.rb +19 -36
- data/spec/sclass_spec.rb +26 -25
- data/spec/spec_helper.rb +9 -0
- data/spec/str_spec.rb +25 -43
- data/spec/super_spec.rb +31 -49
- data/spec/true_spec.rb +2 -4
- data/spec/undef_spec.rb +38 -53
- data/spec/until_spec.rb +13 -105
- data/spec/valias_spec.rb +2 -4
- data/spec/while_spec.rb +35 -117
- data/spec/xstr_spec.rb +2 -4
- data/spec/yield_spec.rb +22 -42
- data/spec/zsuper_spec.rb +8 -16
- metadata +64 -22
- data/spec/cvdecl_spec.rb +0 -12
data/spec/or_spec.rb
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
describe "An Or node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:or, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]]
|
5
|
-
end
|
2
|
+
parse "(a or b)" do
|
3
|
+
[:or, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
parse "((a || b) || (c && d))" do
|
7
|
+
[:or,
|
8
|
+
[:call, nil, :a, [:arglist]],
|
9
|
+
[:or,
|
10
|
+
[:call, nil, :b, [:arglist]],
|
11
|
+
[:and, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
14
12
|
end
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
parse "((a or b) or (c and d))" do
|
15
|
+
[:or,
|
16
|
+
[:call, nil, :a, [:arglist]],
|
17
|
+
[:or,
|
18
|
+
[:call, nil, :b, [:arglist]],
|
19
|
+
[:and, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
22
20
|
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
[:or, [:nil], [:call, nil, :a, [:arglist]]]
|
27
|
-
end
|
22
|
+
parse "() or a" do
|
23
|
+
[:or, [:nil], [:call, nil, :a, [:arglist]]]
|
28
24
|
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
[:or, [:call, nil, :a, [:arglist]], [:nil]]
|
33
|
-
end
|
26
|
+
parse "a or ()" do
|
27
|
+
[:or, [:call, nil, :a, [:arglist]], [:nil]]
|
34
28
|
end
|
35
29
|
end
|
data/spec/postexe_spec.rb
CHANGED
data/spec/regex_spec.rb
CHANGED
@@ -1,28 +1,20 @@
|
|
1
1
|
describe "A Regex node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:call,
|
5
|
-
|
6
|
-
|
7
|
-
[:arglist, [:regex, "", 1]]]
|
8
|
-
end
|
2
|
+
parse "str.split(//i)" do
|
3
|
+
[:call,
|
4
|
+
[:call, nil, :str, [:arglist]],
|
5
|
+
:split,
|
6
|
+
[:arglist, [:regex, "", 1]]]
|
9
7
|
end
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
[:regex, "x", 16]
|
14
|
-
end
|
9
|
+
parse "/x/n" do
|
10
|
+
[:regex, "x", 512]
|
15
11
|
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
[:regex, "x", 0]
|
20
|
-
end
|
13
|
+
parse "/x/o" do
|
14
|
+
[:regex, "x", 0]
|
21
15
|
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
[:regex, "x", 0]
|
26
|
-
end
|
17
|
+
parse "/x/" do
|
18
|
+
[:regex, "x", 0]
|
27
19
|
end
|
28
20
|
end
|
data/spec/rescue_spec.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
describe "A Rescue node" do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
parse "blah rescue nil" do
|
3
|
+
[:rescue,
|
4
|
+
[:call, nil, :blah, [:arglist]],
|
5
|
+
[:resbody, [:array, [:const, :StandardError]], [:nil]]]
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
parse <<-ruby do
|
9
9
|
begin
|
10
10
|
blah
|
11
11
|
rescue
|
12
12
|
end
|
13
13
|
ruby
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
[:rescue,
|
16
|
+
[:call, nil, :blah, [:arglist]],
|
17
|
+
[:resbody, [:array, [:const, :StandardError]], [:nil]]]
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
parse <<-ruby do
|
21
21
|
begin
|
22
22
|
a
|
23
23
|
rescue A
|
@@ -29,16 +29,18 @@ describe "A Rescue node" do
|
|
29
29
|
end
|
30
30
|
ruby
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
[:rescue,
|
33
|
+
[:call, nil, :a, [:arglist]],
|
34
|
+
[:resbody,
|
35
|
+
[:array, [:const, :A]],
|
36
|
+
[:call, nil, :b, [:arglist]],
|
37
|
+
[:resbody,
|
38
|
+
[:array, [:const, :B]],
|
39
|
+
[:call, nil, :c, [:arglist]],
|
40
|
+
[:resbody, [:array, [:const, :C]], [:call, nil, :d, [:arglist]]]]]]
|
39
41
|
end
|
40
42
|
|
41
|
-
|
43
|
+
parse <<-ruby do
|
42
44
|
begin
|
43
45
|
a
|
44
46
|
rescue => @e
|
@@ -47,16 +49,14 @@ describe "A Rescue node" do
|
|
47
49
|
end
|
48
50
|
ruby
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
[:block, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
56
|
-
end
|
52
|
+
[:rescue,
|
53
|
+
[:call, nil, :a, [:arglist]],
|
54
|
+
[:resbody,
|
55
|
+
[:array, [:const, :StandardError], [:iasgn, :@e, [:gvar, :$!]]],
|
56
|
+
[[:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
parse <<-ruby do
|
60
60
|
begin
|
61
61
|
a
|
62
62
|
rescue => e
|
@@ -65,16 +65,14 @@ describe "A Rescue node" do
|
|
65
65
|
end
|
66
66
|
ruby
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
[:block, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
74
|
-
end
|
68
|
+
[:rescue,
|
69
|
+
[:call, nil, :a, [:arglist]],
|
70
|
+
[:resbody,
|
71
|
+
[:array, [:const, :StandardError], [:lasgn, :e, [:gvar, :$!]]],
|
72
|
+
[[:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]]
|
75
73
|
end
|
76
74
|
|
77
|
-
|
75
|
+
parse <<-ruby do
|
78
76
|
begin
|
79
77
|
a
|
80
78
|
rescue => mes
|
@@ -88,46 +86,48 @@ describe "A Rescue node" do
|
|
88
86
|
end
|
89
87
|
ruby
|
90
88
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
89
|
+
[:block,
|
90
|
+
[:rescue,
|
91
|
+
[:call, nil, :a, [:arglist]],
|
92
|
+
[:resbody,
|
93
|
+
[:array, [:const, :StandardError], [:lasgn, :mes, [:gvar, :$!]]],
|
94
|
+
[:nil]]],
|
95
|
+
[:rescue,
|
96
|
+
[:call, nil, :b, [:arglist]],
|
97
|
+
[:resbody,
|
98
|
+
[:array, [:const, :StandardError], [:lasgn, :mes, [:gvar, :$!]]],
|
99
|
+
[:nil]]]]
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
parse <<-ruby do
|
103
103
|
begin
|
104
104
|
blah
|
105
105
|
rescue RuntimeError => r
|
106
106
|
end
|
107
107
|
ruby
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
nil]]
|
115
|
-
end
|
109
|
+
[:rescue,
|
110
|
+
[:call, nil, :blah, [:arglist]],
|
111
|
+
[:resbody,
|
112
|
+
[:array, [:const, :RuntimeError], [:lasgn, :r, [:gvar, :$!]]],
|
113
|
+
[:nil]]]
|
116
114
|
end
|
117
115
|
|
118
|
-
|
116
|
+
parse <<-ruby do
|
119
117
|
begin
|
120
118
|
1
|
121
119
|
rescue => @e
|
122
120
|
end
|
123
121
|
ruby
|
124
122
|
|
125
|
-
|
126
|
-
|
127
|
-
|
123
|
+
[:rescue,
|
124
|
+
[:lit, 1],
|
125
|
+
[:resbody,
|
126
|
+
[:array, [:const, :StandardError], [:iasgn, :@e, [:gvar, :$!]]],
|
127
|
+
[:nil]]]
|
128
128
|
end
|
129
129
|
|
130
|
-
|
130
|
+
parse <<-ruby do
|
131
131
|
begin
|
132
132
|
1
|
133
133
|
rescue
|
@@ -135,24 +135,26 @@ describe "A Rescue node" do
|
|
135
135
|
end
|
136
136
|
ruby
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
|
138
|
+
[:rescue,
|
139
|
+
[:lit, 1],
|
140
|
+
[:resbody, [:array, [:const, :StandardError]], [:lasgn, :var, [:lit, 2]]]]
|
141
141
|
end
|
142
142
|
|
143
|
-
|
143
|
+
parse <<-ruby do
|
144
144
|
begin
|
145
145
|
1
|
146
146
|
rescue => e
|
147
147
|
end
|
148
148
|
ruby
|
149
149
|
|
150
|
-
|
151
|
-
|
152
|
-
|
150
|
+
[:rescue,
|
151
|
+
[:lit, 1],
|
152
|
+
[:resbody,
|
153
|
+
[:array, [:const, :StandardError], [:lasgn, :e, [:gvar, :$!]]],
|
154
|
+
[:nil]]]
|
153
155
|
end
|
154
156
|
|
155
|
-
|
157
|
+
parse <<-ruby do
|
156
158
|
begin
|
157
159
|
1
|
158
160
|
rescue
|
@@ -160,16 +162,14 @@ describe "A Rescue node" do
|
|
160
162
|
end
|
161
163
|
ruby
|
162
164
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
[:attrasgn, [:call, nil, :a, [:arglist]], :b=, [:arglist, [:nil]]]]]
|
169
|
-
end
|
165
|
+
[:rescue,
|
166
|
+
[:lit, 1],
|
167
|
+
[:resbody,
|
168
|
+
[:array, [:const, :StandardError]],
|
169
|
+
[:attrasgn, [:call, nil, :a, [:arglist]], :b=, [:arglist, [:nil]]]]]
|
170
170
|
end
|
171
171
|
|
172
|
-
|
172
|
+
parse <<-ruby do
|
173
173
|
begin
|
174
174
|
1
|
175
175
|
rescue => e
|
@@ -177,14 +177,14 @@ describe "A Rescue node" do
|
|
177
177
|
end
|
178
178
|
ruby
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
180
|
+
[:rescue,
|
181
|
+
[:lit, 1],
|
182
|
+
[:resbody,
|
183
|
+
[:array, [:const, :StandardError], [:lasgn, :e, [:gvar, :$!]]],
|
184
|
+
[:lasgn, :var, [:lit, 2]]]]
|
185
185
|
end
|
186
186
|
|
187
|
-
|
187
|
+
parse <<-ruby do
|
188
188
|
begin
|
189
189
|
12
|
190
190
|
rescue String
|
@@ -194,15 +194,13 @@ describe "A Rescue node" do
|
|
194
194
|
end
|
195
195
|
ruby
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
[:lit, 14]]
|
202
|
-
end
|
197
|
+
[:rescue,
|
198
|
+
[:lit, 12],
|
199
|
+
[:resbody, [:array, [:const, :String]], [:lit, 13]],
|
200
|
+
[:lit, 14]]
|
203
201
|
end
|
204
202
|
|
205
|
-
|
203
|
+
parse <<-ruby do
|
206
204
|
begin
|
207
205
|
12
|
208
206
|
rescue *blah
|
@@ -210,14 +208,12 @@ describe "A Rescue node" do
|
|
210
208
|
end
|
211
209
|
ruby
|
212
210
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
[:resbody, [:splat, [:call, nil, :blah, [:arglist]]], [:lit, 13]]]
|
217
|
-
end
|
211
|
+
[:rescue,
|
212
|
+
[:lit, 12],
|
213
|
+
[:resbody, [:splat, [:call, nil, :blah, [:arglist]]], [:lit, 13]]]
|
218
214
|
end
|
219
215
|
|
220
|
-
|
216
|
+
parse <<-ruby do
|
221
217
|
begin
|
222
218
|
12
|
223
219
|
rescue String, *blah
|
@@ -225,16 +221,14 @@ describe "A Rescue node" do
|
|
225
221
|
end
|
226
222
|
ruby
|
227
223
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
[:lit, 13]]]
|
234
|
-
end
|
224
|
+
[:rescue,
|
225
|
+
[:lit, 12],
|
226
|
+
[:resbody,
|
227
|
+
[:array, [:const, :String], [:splat, [:call, nil, :blah, [:arglist]]]],
|
228
|
+
[:lit, 13]]]
|
235
229
|
end
|
236
230
|
|
237
|
-
|
231
|
+
parse <<-ruby do
|
238
232
|
begin
|
239
233
|
12
|
240
234
|
rescue *blah => e
|
@@ -242,16 +236,15 @@ describe "A Rescue node" do
|
|
242
236
|
end
|
243
237
|
ruby
|
244
238
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
end
|
239
|
+
[:rescue,
|
240
|
+
[:lit, 12],
|
241
|
+
[:resbody,
|
242
|
+
[:splat, [:call, nil, :blah, [:arglist]]],
|
243
|
+
[:lasgn, :e, [:gvar, :$!]],
|
244
|
+
[:lit, 13]]]
|
252
245
|
end
|
253
246
|
|
254
|
-
|
247
|
+
parse <<-ruby do
|
255
248
|
begin
|
256
249
|
12
|
257
250
|
rescue String, *blah => e
|
@@ -259,19 +252,17 @@ describe "A Rescue node" do
|
|
259
252
|
end
|
260
253
|
ruby
|
261
254
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
[:lit, 13]]]
|
271
|
-
end
|
255
|
+
[:rescue,
|
256
|
+
[:lit, 12],
|
257
|
+
[:resbody,
|
258
|
+
[:array,
|
259
|
+
[:const, :String],
|
260
|
+
[:splat, [:call, nil, :blah, [:arglist]]],
|
261
|
+
[:lasgn, :e, [:gvar, :$!]]],
|
262
|
+
[:lit, 13]]]
|
272
263
|
end
|
273
264
|
|
274
|
-
|
265
|
+
parse <<-ruby do
|
275
266
|
begin
|
276
267
|
12
|
277
268
|
rescue String
|
@@ -279,14 +270,12 @@ describe "A Rescue node" do
|
|
279
270
|
end
|
280
271
|
ruby
|
281
272
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
[:resbody, [:array, [:const, :String]], [:return, [:nil]]]]
|
286
|
-
end
|
273
|
+
[:rescue,
|
274
|
+
[:lit, 12],
|
275
|
+
[:resbody, [:array, [:const, :String]], [:return, [:nil]]]]
|
287
276
|
end
|
288
277
|
|
289
|
-
|
278
|
+
parse <<-ruby do
|
290
279
|
begin
|
291
280
|
1
|
292
281
|
rescue
|
@@ -298,16 +287,16 @@ describe "A Rescue node" do
|
|
298
287
|
end
|
299
288
|
ruby
|
300
289
|
|
301
|
-
|
290
|
+
[:rescue,
|
291
|
+
[:lit, 1],
|
292
|
+
[:resbody,
|
293
|
+
[:array, [:const, :StandardError]],
|
302
294
|
[:rescue,
|
303
|
-
[:lit,
|
304
|
-
[:resbody,
|
305
|
-
[:array],
|
306
|
-
[:rescue, [:lit, 2], [:resbody, [:array], [:return, [:lit, 3]]]]]]
|
307
|
-
end
|
295
|
+
[:lit, 2],
|
296
|
+
[:resbody, [:array, [:const, :StandardError]], [:return, [:lit, 3]]]]]]
|
308
297
|
end
|
309
298
|
|
310
|
-
|
299
|
+
parse <<-ruby do
|
311
300
|
begin
|
312
301
|
1
|
313
302
|
rescue
|
@@ -318,18 +307,15 @@ describe "A Rescue node" do
|
|
318
307
|
end
|
319
308
|
ruby
|
320
309
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
[:defn, :x, [:args], [:scope, [:block, [:return, [:lit, 2]]]]],
|
328
|
-
[:call, nil, :x, [:arglist]]]]]
|
329
|
-
end
|
310
|
+
[:rescue,
|
311
|
+
[:lit, 1],
|
312
|
+
[:resbody,
|
313
|
+
[:array, [:const, :StandardError]],
|
314
|
+
[[:defn, :x, [:args], [:scope, [:block, [:return, [:lit, 2]]]]],
|
315
|
+
[:call, nil, :x, [:arglist]]]]]
|
330
316
|
end
|
331
317
|
|
332
|
-
|
318
|
+
parse <<-ruby do
|
333
319
|
begin
|
334
320
|
while 1
|
335
321
|
2
|
@@ -340,10 +326,12 @@ describe "A Rescue node" do
|
|
340
326
|
end
|
341
327
|
ruby
|
342
328
|
|
343
|
-
|
329
|
+
[:rescue,
|
330
|
+
[:while, [:lit, 1], [:block, [:lit, 2], [:break, [:lit, :brk]]], true],
|
331
|
+
[:resbody, [:array, [:const, :StandardError]], [:lit, 3]]]
|
344
332
|
end
|
345
333
|
|
346
|
-
|
334
|
+
parse <<-ruby do
|
347
335
|
begin
|
348
336
|
1
|
349
337
|
rescue
|
@@ -354,6 +342,10 @@ describe "A Rescue node" do
|
|
354
342
|
end
|
355
343
|
ruby
|
356
344
|
|
357
|
-
|
345
|
+
[:rescue,
|
346
|
+
[:lit, 1],
|
347
|
+
[:resbody,
|
348
|
+
[:array, [:const, :StandardError]],
|
349
|
+
[:while, [:lit, 2], [:block, [:lit, 3], [:break, [:lit, :brk]]], true]]]
|
358
350
|
end
|
359
351
|
end
|