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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +2 -9
  4. data/Gemfile +0 -4
  5. data/Rakefile +26 -19
  6. data/ext/rubinius/melbourne/extconf.rb +4 -3
  7. data/ext/rubinius/melbourne/grammar.cpp +2 -2
  8. data/ext/rubinius/melbourne/grammar.y +2 -2
  9. data/ext/rubinius/melbourne/melbourne.cpp +4 -5
  10. data/lib/rubinius/melbourne/version.rb +2 -2
  11. data/lib/rubinius/melbourne.rb +1 -21
  12. data/rubinius-melbourne.gemspec +6 -3
  13. data/spec/alias_spec.rb +13 -18
  14. data/spec/and_spec.rb +6 -12
  15. data/spec/array_spec.rb +28 -54
  16. data/spec/attrasgn_spec.rb +60 -85
  17. data/spec/back_ref_spec.rb +6 -8
  18. data/spec/call_spec.rb +137 -225
  19. data/spec/case_spec.rb +94 -112
  20. data/spec/cdecl_spec.rb +16 -28
  21. data/spec/class_spec.rb +28 -40
  22. data/spec/colon2_spec.rb +2 -4
  23. data/spec/colon3_spec.rb +2 -4
  24. data/spec/const_spec.rb +2 -4
  25. data/spec/custom/runner/relates.rb +4 -0
  26. data/spec/cvar_spec.rb +6 -12
  27. data/spec/cvasgn_spec.rb +20 -15
  28. data/spec/defined_spec.rb +57 -55
  29. data/spec/defn_spec.rb +218 -280
  30. data/spec/defs_spec.rb +30 -38
  31. data/spec/dot2_spec.rb +2 -4
  32. data/spec/dot3_spec.rb +2 -4
  33. data/spec/dregx_spec.rb +20 -34
  34. data/spec/dstr_spec.rb +87 -111
  35. data/spec/dsym_spec.rb +5 -7
  36. data/spec/dxstr_spec.rb +2 -4
  37. data/spec/ensure_spec.rb +32 -40
  38. data/spec/false_spec.rb +2 -4
  39. data/spec/flip2_spec.rb +22 -26
  40. data/spec/flip3_spec.rb +15 -17
  41. data/spec/for_spec.rb +25 -23
  42. data/spec/gasgn_spec.rb +4 -8
  43. data/spec/gvar_spec.rb +8 -16
  44. data/spec/hash_spec.rb +14 -18
  45. data/spec/iasgn_spec.rb +8 -14
  46. data/spec/if_spec.rb +50 -80
  47. data/spec/iter_spec.rb +328 -402
  48. data/spec/lasgn_spec.rb +143 -200
  49. data/spec/lit_spec.rb +20 -40
  50. data/spec/masgn_spec.rb +278 -309
  51. data/spec/match2_spec.rb +6 -10
  52. data/spec/match3_spec.rb +9 -13
  53. data/spec/match_spec.rb +2 -4
  54. data/spec/module_spec.rb +12 -16
  55. data/spec/nil_spec.rb +2 -4
  56. data/spec/not_spec.rb +6 -8
  57. data/spec/nth_ref_spec.rb +2 -4
  58. data/spec/op_asgn_spec.rb +118 -158
  59. data/spec/or_spec.rb +18 -24
  60. data/spec/postexe_spec.rb +2 -4
  61. data/spec/regex_spec.rb +11 -19
  62. data/spec/rescue_spec.rb +135 -143
  63. data/spec/return_spec.rb +19 -36
  64. data/spec/sclass_spec.rb +26 -25
  65. data/spec/spec_helper.rb +9 -0
  66. data/spec/str_spec.rb +25 -43
  67. data/spec/super_spec.rb +31 -49
  68. data/spec/true_spec.rb +2 -4
  69. data/spec/undef_spec.rb +38 -53
  70. data/spec/until_spec.rb +13 -105
  71. data/spec/valias_spec.rb +2 -4
  72. data/spec/while_spec.rb +35 -117
  73. data/spec/xstr_spec.rb +2 -4
  74. data/spec/yield_spec.rb +22 -42
  75. data/spec/zsuper_spec.rb +8 -16
  76. metadata +64 -22
  77. 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
- relates "(a or b)" do
3
- parse do
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
- relates "((a || b) || (c && d))" do
9
- parse do
10
- [:or,
11
- [:or, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]],
12
- [:and, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
13
- end
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
- relates "((a or b) or (c and d))" do
17
- parse do
18
- [:or,
19
- [:or, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]],
20
- [:and, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
21
- end
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
- relates "() or a" do
25
- parse do
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
- relates "a or ()" do
31
- parse do
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
@@ -1,7 +1,5 @@
1
1
  describe "A Postexe node" do
2
- relates "END { 1 }" do
3
- parse do
4
- [:iter, [:postexe], nil, [:lit, 1]]
5
- end
2
+ parse "END { 1 }" do
3
+ [:call, nil, :at_exit, [:arglist, [:iter, nil, [:block, [:lit, 1]]]]]
6
4
  end
7
5
  end
data/spec/regex_spec.rb CHANGED
@@ -1,28 +1,20 @@
1
1
  describe "A Regex node" do
2
- relates "str.split(//i)" do
3
- parse do
4
- [:call,
5
- [:call, nil, :str, [:arglist]],
6
- :split,
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
- relates "/x/n" do
12
- parse do
13
- [:regex, "x", 16]
14
- end
9
+ parse "/x/n" do
10
+ [:regex, "x", 512]
15
11
  end
16
12
 
17
- relates "/x/o" do
18
- parse do
19
- [:regex, "x", 0]
20
- end
13
+ parse "/x/o" do
14
+ [:regex, "x", 0]
21
15
  end
22
16
 
23
- relates "/x/" do
24
- parse do
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
- relates "blah rescue nil" do
3
- parse do
4
- [:rescue, [:call, nil, :blah, [:arglist]], [:resbody, [:array], [:nil]]]
5
- end
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
- relates <<-ruby do
8
+ parse <<-ruby do
9
9
  begin
10
10
  blah
11
11
  rescue
12
12
  end
13
13
  ruby
14
14
 
15
- parse do
16
- [:rescue, [:call, nil, :blah, [:arglist]], [:resbody, [:array], nil]]
17
- end
15
+ [:rescue,
16
+ [:call, nil, :blah, [:arglist]],
17
+ [:resbody, [:array, [:const, :StandardError]], [:nil]]]
18
18
  end
19
19
 
20
- relates <<-ruby do
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
- parse do
33
- [:rescue,
34
- [:call, nil, :a, [:arglist]],
35
- [:resbody, [:array, [:const, :A]], [:call, nil, :b, [:arglist]]],
36
- [:resbody, [:array, [:const, :B]], [:call, nil, :c, [:arglist]]],
37
- [:resbody, [:array, [:const, :C]], [:call, nil, :d, [:arglist]]]]
38
- end
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
- relates <<-ruby do
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
- parse do
51
- [:rescue,
52
- [:call, nil, :a, [:arglist]],
53
- [:resbody,
54
- [:array, [:iasgn, :@e, [:gvar, :$!]]],
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
- relates <<-ruby do
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
- parse do
69
- [:rescue,
70
- [:call, nil, :a, [:arglist]],
71
- [:resbody,
72
- [:array, [:lasgn, :e, [:gvar, :$!]]],
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
- relates <<-ruby do
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
- parse do
92
- [:block,
93
- [:rescue,
94
- [:call, nil, :a, [:arglist]],
95
- [:resbody, [:array, [:lasgn, :mes, [:gvar, :$!]]], nil]],
96
- [:rescue,
97
- [:call, nil, :b, [:arglist]],
98
- [:resbody, [:array, [:lasgn, :mes, [:gvar, :$!]]], nil]]]
99
- end
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
- relates <<-ruby do
102
+ parse <<-ruby do
103
103
  begin
104
104
  blah
105
105
  rescue RuntimeError => r
106
106
  end
107
107
  ruby
108
108
 
109
- parse do
110
- [:rescue,
111
- [:call, nil, :blah, [:arglist]],
112
- [:resbody,
113
- [:array, [:const, :RuntimeError], [:lasgn, :r, [:gvar, :$!]]],
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
- relates <<-ruby do
116
+ parse <<-ruby do
119
117
  begin
120
118
  1
121
119
  rescue => @e
122
120
  end
123
121
  ruby
124
122
 
125
- parse do
126
- [:rescue, [:lit, 1], [:resbody, [:array, [:iasgn, :@e, [:gvar, :$!]]], nil]]
127
- end
123
+ [:rescue,
124
+ [:lit, 1],
125
+ [:resbody,
126
+ [:array, [:const, :StandardError], [:iasgn, :@e, [:gvar, :$!]]],
127
+ [:nil]]]
128
128
  end
129
129
 
130
- relates <<-ruby do
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
- parse do
139
- [:rescue, [:lit, 1], [:resbody, [:array], [:lasgn, :var, [:lit, 2]]]]
140
- end
138
+ [:rescue,
139
+ [:lit, 1],
140
+ [:resbody, [:array, [:const, :StandardError]], [:lasgn, :var, [:lit, 2]]]]
141
141
  end
142
142
 
143
- relates <<-ruby do
143
+ parse <<-ruby do
144
144
  begin
145
145
  1
146
146
  rescue => e
147
147
  end
148
148
  ruby
149
149
 
150
- parse do
151
- [:rescue, [:lit, 1], [:resbody, [:array, [:lasgn, :e, [:gvar, :$!]]], nil]]
152
- end
150
+ [:rescue,
151
+ [:lit, 1],
152
+ [:resbody,
153
+ [:array, [:const, :StandardError], [:lasgn, :e, [:gvar, :$!]]],
154
+ [:nil]]]
153
155
  end
154
156
 
155
- relates <<-ruby do
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
- parse do
164
- [:rescue,
165
- [:lit, 1],
166
- [:resbody,
167
- [:array],
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
- relates <<-ruby do
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
- parse do
181
- [:rescue,
182
- [:lit, 1],
183
- [:resbody, [:array, [:lasgn, :e, [:gvar, :$!]]], [:lasgn, :var, [:lit, 2]]]]
184
- end
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
- relates <<-ruby do
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
- parse do
198
- [:rescue,
199
- [:lit, 12],
200
- [:resbody, [:array, [:const, :String]], [:lit, 13]],
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
- relates <<-ruby do
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
- parse do
214
- [:rescue,
215
- [:lit, 12],
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
- relates <<-ruby do
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
- parse do
229
- [:rescue,
230
- [:lit, 12],
231
- [:resbody,
232
- [:array, [:const, :String], [:splat, [:call, nil, :blah, [:arglist]]]],
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
- relates <<-ruby do
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
- parse do
246
- [:rescue,
247
- [:lit, 12],
248
- [:resbody,
249
- [:splat, [:call, nil, :blah, [:arglist]], [:lasgn, :e, [:gvar, :$!]]],
250
- [:lit, 13]]]
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
- relates <<-ruby do
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
- parse do
263
- [:rescue,
264
- [:lit, 12],
265
- [:resbody,
266
- [:array,
267
- [:const, :String],
268
- [:splat, [:call, nil, :blah, [:arglist]]],
269
- [:lasgn, :e, [:gvar, :$!]]],
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
- relates <<-ruby do
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
- parse do
283
- [:rescue,
284
- [:lit, 12],
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
- relates <<-ruby do
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
- parse do
290
+ [:rescue,
291
+ [:lit, 1],
292
+ [:resbody,
293
+ [:array, [:const, :StandardError]],
302
294
  [:rescue,
303
- [:lit, 1],
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
- relates <<-ruby do
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
- parse do
322
- [:rescue,
323
- [:lit, 1],
324
- [:resbody,
325
- [:array],
326
- [:block,
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
- relates <<-ruby do
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
- # TODO
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
- relates <<-ruby do
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
- # TODO
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