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/case_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  describe "A Case node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  var = 2
4
4
  result = ""
5
5
  case var
@@ -25,32 +25,30 @@ describe "A Case node" do
25
25
  end
26
26
  ruby
27
27
 
28
- parse do
29
- [:block,
30
- [:lasgn, :var, [:lit, 2]],
31
- [:lasgn, :result, [:str, ""]],
32
- [:case,
33
- [:lvar, :var],
34
- [:when,
35
- [:array, [:lit, 1]],
36
- [:block,
37
- [:call, nil, :puts, [:arglist, [:str, "something"]]],
38
- [:lasgn, :result, [:str, "red"]]]],
39
- [:when,
40
- [:array, [:lit, 2], [:lit, 3]],
41
- [:lasgn, :result, [:str, "yellow"]]],
42
- [:when, [:array, [:lit, 4]], nil],
43
- [:lasgn, :result, [:str, "green"]]],
44
- [:case,
45
- [:lvar, :result],
46
- [:when, [:array, [:str, "red"]], [:lasgn, :var, [:lit, 1]]],
47
- [:when, [:array, [:str, "yellow"]], [:lasgn, :var, [:lit, 2]]],
48
- [:when, [:array, [:str, "green"]], [:lasgn, :var, [:lit, 3]]],
49
- nil]]
50
- end
28
+ [:block,
29
+ [:lasgn, :var, [:lit, 2]],
30
+ [:lasgn, :result, [:str, ""]],
31
+ [:case,
32
+ [:lvar, :var],
33
+ [:when,
34
+ [:array, [:lit, 1]],
35
+ [:block,
36
+ [:call, nil, :puts, [:arglist, [:str, "something"]]],
37
+ [:lasgn, :result, [:str, "red"]]]],
38
+ [:when,
39
+ [:array, [:lit, 2], [:lit, 3]],
40
+ [:lasgn, :result, [:str, "yellow"]]],
41
+ [:when, [:array, [:lit, 4]], [:nil]],
42
+ [:lasgn, :result, [:str, "green"]]],
43
+ [:case,
44
+ [:lvar, :result],
45
+ [:when, [:array, [:str, "red"]], [:lasgn, :var, [:lit, 1]]],
46
+ [:when, [:array, [:str, "yellow"]], [:lasgn, :var, [:lit, 2]]],
47
+ [:when, [:array, [:str, "green"]], [:lasgn, :var, [:lit, 3]]],
48
+ [:nil]]]
51
49
  end
52
50
 
53
- relates <<-ruby do
51
+ parse <<-ruby do
54
52
  case a
55
53
  when b then
56
54
  case
@@ -64,25 +62,23 @@ describe "A Case node" do
64
62
  end
65
63
  ruby
66
64
 
67
- parse do
65
+ [:case,
66
+ [:call, nil, :a, [:arglist]],
67
+ [:when,
68
+ [:array, [:call, nil, :b, [:arglist]]],
68
69
  [:case,
69
- [:call, nil, :a, [:arglist]],
70
+ nil,
70
71
  [:when,
71
- [:array, [:call, nil, :b, [:arglist]]],
72
- [:case,
73
- nil,
74
- [:when,
75
- [:array,
76
- [:and,
77
- [:call, nil, :d, [:arglist]],
78
- [:call, nil, :e, [:arglist]]]],
79
- [:call, nil, :f, [:arglist]]],
80
- nil]],
81
- nil]
82
- end
72
+ [:array,
73
+ [:and,
74
+ [:call, nil, :d, [:arglist]],
75
+ [:call, nil, :e, [:arglist]]]],
76
+ [:call, nil, :f, [:arglist]]],
77
+ [:nil]]],
78
+ [:nil]]
83
79
  end
84
80
 
85
- relates <<-ruby do
81
+ parse <<-ruby do
86
82
  var1 = 1
87
83
  var2 = 2
88
84
  result = nil
@@ -110,32 +106,30 @@ describe "A Case node" do
110
106
  end
111
107
  ruby
112
108
 
113
- parse do
114
- [:block,
115
- [:lasgn, :var1, [:lit, 1]],
116
- [:lasgn, :var2, [:lit, 2]],
117
- [:lasgn, :result, [:nil]],
109
+ [:block,
110
+ [:lasgn, :var1, [:lit, 1]],
111
+ [:lasgn, :var2, [:lit, 2]],
112
+ [:lasgn, :result, [:nil]],
113
+ [:case,
114
+ [:lvar, :var1],
115
+ [:when,
116
+ [:array, [:lit, 1]],
117
+ [:case,
118
+ [:lvar, :var2],
119
+ [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 1]]],
120
+ [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 2]]],
121
+ [:lasgn, :result, [:lit, 3]]]],
122
+ [:when,
123
+ [:array, [:lit, 2]],
118
124
  [:case,
119
- [:lvar, :var1],
120
- [:when,
121
- [:array, [:lit, 1]],
122
- [:case,
123
- [:lvar, :var2],
124
- [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 1]]],
125
- [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 2]]],
126
- [:lasgn, :result, [:lit, 3]]]],
127
- [:when,
128
- [:array, [:lit, 2]],
129
- [:case,
130
- [:lvar, :var2],
131
- [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 4]]],
132
- [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 5]]],
133
- [:lasgn, :result, [:lit, 6]]]],
134
- [:lasgn, :result, [:lit, 7]]]]
135
- end
125
+ [:lvar, :var2],
126
+ [:when, [:array, [:lit, 1]], [:lasgn, :result, [:lit, 4]]],
127
+ [:when, [:array, [:lit, 2]], [:lasgn, :result, [:lit, 5]]],
128
+ [:lasgn, :result, [:lit, 6]]]],
129
+ [:lasgn, :result, [:lit, 7]]]]
136
130
  end
137
131
 
138
- relates <<-ruby do
132
+ parse <<-ruby do
139
133
  case
140
134
  when (a == 1) then
141
135
  :a
@@ -146,22 +140,20 @@ describe "A Case node" do
146
140
  end
147
141
  ruby
148
142
 
149
- parse do
150
- [:case,
151
- nil,
152
- [:when,
153
- [:array,
154
- [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 1]]]],
155
- [:lit, :a]],
156
- [:when,
157
- [:array,
158
- [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 2]]]],
159
- [:lit, :b]],
160
- [:lit, :c]]
161
- end
143
+ [:case,
144
+ nil,
145
+ [:when,
146
+ [:array,
147
+ [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 1]]]],
148
+ [:lit, :a]],
149
+ [:when,
150
+ [:array,
151
+ [:call, [:call, nil, :a, [:arglist]], :==, [:arglist, [:lit, 2]]]],
152
+ [:lit, :b]],
153
+ [:lit, :c]]
162
154
  end
163
155
 
164
- relates <<-ruby do
156
+ parse <<-ruby do
165
157
  case a
166
158
  when :b, *c then
167
159
  d
@@ -170,51 +162,43 @@ describe "A Case node" do
170
162
  end
171
163
  ruby
172
164
 
173
- parse do
174
- [:case,
175
- [:call, nil, :a, [:arglist]],
176
- [:when,
177
- [:array, [:lit, :b], [:when, [:call, nil, :c, [:arglist]], nil]],
178
- [:call, nil, :d, [:arglist]]],
179
- [:call, nil, :e, [:arglist]]]
180
- end
165
+ [:case,
166
+ [:call, nil, :a, [:arglist]],
167
+ [:when,
168
+ [:array, [:lit, :b], [:when, [:call, nil, :c, [:arglist]], nil]],
169
+ [:call, nil, :d, [:arglist]]],
170
+ [:call, nil, :e, [:arglist]]]
181
171
  end
182
172
 
183
- relates <<-ruby do
173
+ parse <<-ruby do
184
174
  case true
185
175
  when String, *%w(foo bar baz) then
186
176
  12
187
177
  end
188
178
  ruby
189
179
 
190
- parse do
191
- [:case,
192
- [:true],
193
- [:when,
194
- [:array,
195
- [:const, :String],
196
- [:when, [:array, [:str, "foo"], [:str, "bar"], [:str, "baz"]], nil]],
197
- [:lit, 12]],
198
- nil]
199
- end
180
+ [:case,
181
+ [:true],
182
+ [:when,
183
+ [:array, [:const, :String], [:str, "foo"], [:str, "bar"], [:str, "baz"]],
184
+ [:lit, 12]],
185
+ nil]
200
186
  end
201
187
 
202
- relates <<-ruby do
188
+ parse <<-ruby do
203
189
  case ()
204
190
  when a
205
191
  1
206
192
  end
207
193
  ruby
208
194
 
209
- parse do
210
- [:case,
211
- [:nil],
212
- [:when, [:array, [:call, nil, :a, [:arglist]]], [:lit, 1]],
213
- nil]
214
- end
195
+ [:case,
196
+ [:nil],
197
+ [:when, [:array, [:call, nil, :a, [:arglist]]], [:lit, 1]],
198
+ nil]
215
199
  end
216
200
 
217
- relates <<-ruby do
201
+ parse <<-ruby do
218
202
  x = 1
219
203
  case a
220
204
  when x
@@ -222,13 +206,11 @@ describe "A Case node" do
222
206
  end
223
207
  ruby
224
208
 
225
- parse do
226
- [:block,
227
- [:lasgn, :x, [:lit, 1]],
228
- [:case,
229
- [:call, nil, :a, [:arglist]],
230
- [:when, [:array, [:lvar, :x]], [:lit, 2]],
231
- nil]]
232
- end
209
+ [:block,
210
+ [:lasgn, :x, [:lit, 1]],
211
+ [:case,
212
+ [:call, nil, :a, [:arglist]],
213
+ [:when, [:array, [:lvar, :x]], [:lit, 2]],
214
+ nil]]
233
215
  end
234
216
  end
data/spec/cdecl_spec.rb CHANGED
@@ -1,45 +1,33 @@
1
1
  describe "A Cdecl node" do
2
- relates "X = 42" do
3
- parse do
4
- [:cdecl, :X, [:lit, 42]]
5
- end
2
+ parse "X = 42" do
3
+ [:cdecl, :X, [:lit, 42]]
6
4
  end
7
5
 
8
- relates "::X = 1" do
9
- parse do
10
- [:cdecl, [:colon3, :X], [:lit, 1]]
11
- end
6
+ parse "::X = 1" do
7
+ [:cdecl, [:colon3, :X], [:lit, 1]]
12
8
  end
13
9
 
14
- relates "X::Y = 1" do
15
- parse do
16
- [:cdecl, [:colon2, [:const, :X], :Y], [:lit, 1]]
17
- end
10
+ parse "X::Y = 1" do
11
+ [:cdecl, [:colon2, [:const, :X], :Y], [:lit, 1]]
18
12
  end
19
13
 
20
- relates "X::Y::Z = a" do
21
- parse do
22
- [:cdecl,
23
- [:colon2, [:colon2, [:const, :X], :Y], :Z],
24
- [:call, nil, :a, [:arglist]]]
25
- end
14
+ parse "X::Y::Z = a" do
15
+ [:cdecl,
16
+ [:colon2, [:colon2, [:const, :X], :Y], :Z],
17
+ [:call, nil, :a, [:arglist]]]
26
18
  end
27
19
 
28
- relates "a::A = 1" do
29
- parse do
30
- [:cdecl, [:colon2, [:call, nil, :a, [:arglist]], :A], [:lit, 1]]
31
- end
20
+ parse "a::A = 1" do
21
+ [:cdecl, [:colon2, [:call, nil, :a, [:arglist]], :A], [:lit, 1]]
32
22
  end
33
23
 
34
- relates <<-ruby do
24
+ parse <<-ruby do
35
25
  a = Object
36
26
  a::B = b
37
27
  ruby
38
28
 
39
- parse do
40
- [:block,
41
- [:lasgn, :a, [:const, :Object]],
42
- [:cdecl, [:colon2, [:lvar, :a], :B], [:call, nil, :b, [:arglist]]]]
43
- end
29
+ [:block,
30
+ [:lasgn, :a, [:const, :Object]],
31
+ [:cdecl, [:colon2, [:lvar, :a], :B], [:call, nil, :b, [:arglist]]]]
44
32
  end
45
33
  end
data/spec/class_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  describe "A Class node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  class X
4
4
  puts((1 + 1))
5
5
  def blah
@@ -8,76 +8,64 @@ describe "A Class node" do
8
8
  end
9
9
  ruby
10
10
 
11
- parse do
12
- [:class,
13
- :X,
14
- nil,
15
- [:scope,
16
- [:block,
17
- [:call,
18
- nil,
19
- :puts,
20
- [:arglist, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]]],
21
- [:defn,
22
- :blah,
23
- [:args],
24
- [:scope,
25
- [:block, [:call, nil, :puts, [:arglist, [:str, "hello"]]]]]]]]]
26
- end
11
+ [:class,
12
+ :X,
13
+ nil,
14
+ [:scope,
15
+ [:block,
16
+ [:call,
17
+ nil,
18
+ :puts,
19
+ [:arglist, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]]],
20
+ [:defn,
21
+ :blah,
22
+ [:args],
23
+ [:scope,
24
+ [:block, [:call, nil, :puts, [:arglist, [:str, "hello"]]]]]]]]]
27
25
  end
28
26
 
29
- relates <<-ruby do
27
+ parse <<-ruby do
30
28
  class ::Y
31
29
  c
32
30
  end
33
31
  ruby
34
32
 
35
- parse do
36
- [:class, [:colon3, :Y], nil, [:scope, [:call, nil, :c, [:arglist]]]]
37
- end
33
+ [:class, [:colon3, :Y], nil, [:scope, [:block, [:call, nil, :c, [:arglist]]]]]
38
34
  end
39
35
 
40
- relates <<-ruby do
36
+ parse <<-ruby do
41
37
  class X::Y
42
38
  c
43
39
  end
44
40
  ruby
45
41
 
46
- parse do
47
- [:class,
48
- [:colon2, [:const, :X], :Y],
49
- nil,
50
- [:scope, [:call, nil, :c, [:arglist]]]]
51
- end
42
+ [:class,
43
+ [:colon2, [:const, :X], :Y],
44
+ nil,
45
+ [:scope, [:block, [:call, nil, :c, [:arglist]]]]]
52
46
  end
53
47
 
54
- relates <<-ruby do
48
+ parse <<-ruby do
55
49
  class X < Array
56
50
  end
57
51
  ruby
58
52
 
59
- parse do
60
- [:class, :X, [:const, :Array], [:scope]]
61
- end
53
+ [:class, :X, [:const, :Array], [:scope]]
62
54
  end
63
55
 
64
- relates <<-ruby do
56
+ parse <<-ruby do
65
57
  class X < expr
66
58
  end
67
59
  ruby
68
60
 
69
- parse do
70
- [:class, :X, [:call, nil, :expr, [:arglist]], [:scope]]
71
- end
61
+ [:class, :X, [:call, nil, :expr, [:arglist]], [:scope]]
72
62
  end
73
63
 
74
- relates <<-ruby do
64
+ parse <<-ruby do
75
65
  class X < Object
76
66
  end
77
67
  ruby
78
68
 
79
- parse do
80
- [:class, :X, [:const, :Object], [:scope]]
81
- end
69
+ [:class, :X, [:const, :Object], [:scope]]
82
70
  end
83
71
  end