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/return_spec.rb CHANGED
@@ -1,57 +1,40 @@
1
1
  describe "A Return node" do
2
- relates "return" do
3
- parse do
4
- [:return]
5
- end
2
+ parse "return" do
3
+ [:return]
6
4
  end
7
5
 
8
- relates "return 1" do
9
- parse do
10
- [:return, [:lit, 1]]
11
- end
6
+ parse "return 1" do
7
+ [:return, [:lit, 1]]
12
8
  end
13
9
 
14
- relates "return *1" do
15
- parse do
16
- [:return, [:svalue, [:splat, [:lit, 1]]]]
17
- end
10
+ parse "return *1" do
11
+ [:return, [:splat, [:lit, 1]]]
18
12
  end
19
13
 
20
- relates <<-ruby do
14
+ parse <<-ruby do
21
15
  x = 1, 2
22
16
  return *x
23
17
  ruby
24
18
 
25
- parse do
26
- [:block,
27
- [:lasgn, :x, [:svalue, [:array, [:lit, 1], [:lit, 2]]]],
28
- [:return, [:svalue, [:splat, [:lvar, :x]]]]]
29
- end
19
+ [:block,
20
+ [:lasgn, :x, [:array, [:lit, 1], [:lit, 2]]],
21
+ [:return, [:splat, [:lvar, :x]]]]
30
22
  end
31
23
 
32
- relates "return 1, 2, 3" do
33
- parse do
34
- [:return, [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
35
- end
24
+ parse "return 1, 2, 3" do
25
+ [:return, [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
36
26
  end
37
27
 
38
- relates "return 1, 2, *c" do
39
- parse do
40
- [:return,
41
- [:array,
42
- [:lit, 1], [:lit, 2], [:splat, [:call, nil, :c, [:arglist]]]]]
43
- end
28
+ parse "return 1, 2, *c" do
29
+ [:return,
30
+ [:argscat, [:array, [:lit, 1], [:lit, 2]], [:call, nil, :c, [:arglist]]]]
44
31
  end
45
32
 
46
- relates "return [*[1]]" do
47
- parse do
48
- [:return, [:array, [:splat, [:array, [:lit, 1]]]]]
49
- end
33
+ parse "return [*[1]]" do
34
+ [:return, [:splat, [:array, [:lit, 1]]]]
50
35
  end
51
36
 
52
- relates "return *[1]" do
53
- parse do
54
- [:return, [:svalue, [:splat, [:array, [:lit, 1]]]]]
55
- end
37
+ parse "return *[1]" do
38
+ [:return, [:splat, [:array, [:lit, 1]]]]
56
39
  end
57
40
  end
data/spec/sclass_spec.rb CHANGED
@@ -1,16 +1,14 @@
1
1
  describe "An Sclass node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  class << self
4
4
  42
5
5
  end
6
6
  ruby
7
7
 
8
- parse do
9
- [:sclass, [:self], [:scope, [:lit, 42]]]
10
- end
8
+ [:sclass, [:self], [:scope, [:block, [:lit, 42]]]]
11
9
  end
12
10
 
13
- relates <<-ruby do
11
+ parse <<-ruby do
14
12
  class A
15
13
  class << self
16
14
  a
@@ -20,36 +18,39 @@ describe "An Sclass node" do
20
18
  end
21
19
  ruby
22
20
 
23
- parse do
24
- [:class,
25
- :A,
26
- nil,
27
- [:scope,
28
- [:block,
29
- [:sclass, [:self], [:scope, [:call, nil, :a, [:arglist]]]],
30
- [:class, :B, nil, [:scope]]]]]
31
- end
21
+ [:class,
22
+ :A,
23
+ nil,
24
+ [:scope,
25
+ [:block,
26
+ [:sclass, [:self], [:scope, [:block, [:call, nil, :a, [:arglist]]]]],
27
+ [:class, :B, nil, [:scope]]]]]
32
28
  end
33
29
 
34
- relates <<-ruby do
30
+ parse <<-ruby do
35
31
  x = "a"
36
32
  class << x
37
33
  end
38
34
  ruby
39
35
 
40
- parse do
41
- [:block,
42
- [:lasgn, :x, [:str, "a"]],
43
- [:sclass, [:lvar, :x], [:scope]]]
44
- end
36
+ [:block,
37
+ [:lasgn, :x, [:str, "a"]],
38
+ [:sclass, [:lvar, :x], [:scope]]]
45
39
  end
46
40
 
47
- relates <<-ruby do
48
- x = "a"
49
- m do
50
- class << x
41
+ parse <<-ruby do
42
+ x = "a"
43
+ m do
44
+ class << x
45
+ end
51
46
  end
52
- end
53
47
  ruby
48
+
49
+ [:block,
50
+ [:lasgn, :x, [:str, "a"]],
51
+ [:call,
52
+ nil,
53
+ :m,
54
+ [:arglist, [:iter, [:args], [:sclass, [:lvar, :x], [:scope]]]]]]
54
55
  end
55
56
  end
@@ -0,0 +1,9 @@
1
+ require 'rubinius/bridge'
2
+ require 'rubinius/toolset'
3
+
4
+ Rubinius::ToolSets.create :spec do
5
+ require "rubinius/melbourne"
6
+ require "rubinius/processor"
7
+ require "rubinius/compiler"
8
+ require "rubinius/ast"
9
+ end
data/spec/str_spec.rb CHANGED
@@ -1,48 +1,38 @@
1
1
  describe "A Str node" do
2
- relates '"x"' do
3
- parse do
4
- [:str, "x"]
5
- end
2
+ parse '"x"' do
3
+ [:str, "x"]
6
4
  end
7
5
 
8
- relates <<-ruby do
6
+ parse <<-ruby do
9
7
  "before" \
10
8
  " after"
11
9
  ruby
12
10
 
13
- parse do
14
- [:str, "before after"]
15
- end
11
+ [:str, "before after"]
16
12
  end
17
13
 
18
- relates '"before" " after"' do
19
- parse do
20
- [:str, "before after"]
21
- end
14
+ parse '"before" " after"' do
15
+ [:str, "before after"]
22
16
  end
23
17
 
24
- relates <<-ruby do
18
+ parse <<-ruby do
25
19
  "file = \#{__FILE__}\n"
26
20
  ruby
27
21
 
28
- parse do
29
- [:dstr, "file = ", [:evstr, [:file]], [:str, "\n"]]
30
- end
22
+ [:dstr, "file = ", [:evstr, [:file]], [:str, "\n"]]
31
23
  end
32
24
 
33
- relates <<-ruby do
25
+ parse <<-ruby do
34
26
  <<'EOM'.strip
35
27
  blah
36
28
  blah
37
29
  EOM
38
30
  ruby
39
31
 
40
- parse do
41
- [:call, [:str, " blah\nblah\n"], :strip, [:arglist]]
42
- end
32
+ [:call, [:str, " blah\nblah\n"], :strip, [:arglist]]
43
33
  end
44
34
 
45
- relates <<-ruby do
35
+ parse <<-ruby do
46
36
  a += <<-H1 + b + <<-H2
47
37
  first
48
38
  H1
@@ -50,21 +40,19 @@ H1
50
40
  H2
51
41
  ruby
52
42
 
53
- parse do
54
- [:lasgn,
55
- :a,
43
+ [:lasgn,
44
+ :a,
45
+ [:call,
46
+ [:lvar, :a],
47
+ :+,
48
+ [:arglist,
56
49
  [:call,
57
- [:lvar, :a],
50
+ [:call, [:str, " first\n"], :+, [:arglist, [:call, nil, :b, [:arglist]]]],
58
51
  :+,
59
- [:arglist,
60
- [:call,
61
- [:call, [:str, " first\n"], :+, [:arglist, [:call, nil, :b, [:arglist]]]],
62
- :+,
63
- [:arglist, [:str, " second\n"]]]]]]
64
- end
52
+ [:arglist, [:str, " second\n"]]]]]]
65
53
  end
66
54
 
67
- relates <<-ruby do
55
+ parse <<-ruby do
68
56
  <<-EOM
69
57
  blah
70
58
  blah
@@ -72,26 +60,20 @@ blah
72
60
  EOM
73
61
  ruby
74
62
 
75
- parse do
76
- [:str, " blah\nblah\n\n"]
77
- end
63
+ [:str, " blah\nblah\n\n"]
78
64
  end
79
65
 
80
- relates <<-ruby do
66
+ parse <<-ruby do
81
67
  <<'EOM'
82
68
  blah
83
69
  blah
84
70
  EOM
85
71
  ruby
86
72
 
87
- parse do
88
- [:str, " blah\nblah\n"]
89
- end
73
+ [:str, " blah\nblah\n"]
90
74
  end
91
75
 
92
- relates "%(blah)" do
93
- parse do
94
- [:str, "blah"]
95
- end
76
+ parse "%(blah)" do
77
+ [:str, "blah"]
96
78
  end
97
79
  end
data/spec/super_spec.rb CHANGED
@@ -1,93 +1,75 @@
1
1
  describe "A Super node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  def x
4
4
  super()
5
5
  end
6
6
  ruby
7
7
 
8
- parse do
9
- [:defn, :x, [:args], [:scope, [:block, [:super]]]]
10
- end
8
+ [:defn, :x, [:args], [:scope, [:block, [:super]]]]
11
9
  end
12
10
 
13
- relates <<-ruby do
11
+ parse <<-ruby do
14
12
  def x(&block)
15
13
  super(&block)
16
14
  end
17
15
  ruby
18
16
 
19
- parse do
20
- [:defn,
21
- :x,
22
- [:args, :"&block"],
23
- [:scope, [:block, [:super, [:block_pass, [:lvar, :block]]]]]]
24
- end
17
+ [:defn,
18
+ :x,
19
+ [:args, :"&block"],
20
+ [:scope, [:block, [:super, [:block_pass, [:lvar, :block]]]]]]
25
21
  end
26
22
 
27
- relates <<-ruby do
23
+ parse <<-ruby do
28
24
  def x
29
25
  super([24, 42])
30
26
  end
31
27
  ruby
32
28
 
33
- parse do
34
- [:defn,
35
- :x,
36
- [:args],
37
- [:scope, [:block, [:super, [:array, [:lit, 24], [:lit, 42]]]]]]
38
- end
29
+ [:defn,
30
+ :x,
31
+ [:args],
32
+ [:scope, [:block, [:super, [:array, [:lit, 24], [:lit, 42]]]]]]
39
33
  end
40
34
 
41
- relates <<-ruby do
35
+ parse <<-ruby do
42
36
  def x
43
37
  super(4)
44
38
  end
45
39
  ruby
46
40
 
47
- parse do
48
- [:defn, :x, [:args], [:scope, [:block, [:super, [:lit, 4]]]]]
49
- end
41
+ [:defn, :x, [:args], [:scope, [:block, [:super, [:lit, 4]]]]]
50
42
  end
51
43
 
52
- relates "super(a, &b)" do
53
- parse do
54
- [:super,
55
- [:call, nil, :a, [:arglist]],
56
- [:block_pass, [:call, nil, :b, [:arglist]]]]
57
- end
44
+ parse "super(a, &b)" do
45
+ [:super,
46
+ [:call, nil, :a, [:arglist]],
47
+ [:block_pass, [:call, nil, :b, [:arglist]]]]
58
48
  end
59
49
 
60
- relates "super(a, *b)" do
61
- parse do
62
- [:super,
63
- [:call, nil, :a, [:arglist]],
64
- [:splat, [:call, nil, :b, [:arglist]]]]
65
- end
50
+ parse "super(a, *b)" do
51
+ [:super,
52
+ [:call, nil, :a, [:arglist]],
53
+ [:splat, [:call, nil, :b, [:arglist]]]]
66
54
  end
67
55
 
68
- relates <<-ruby do
56
+ parse <<-ruby do
69
57
  def x
70
58
  super(24, 42)
71
59
  end
72
60
  ruby
73
61
 
74
- parse do
75
- [:defn,
76
- :x,
77
- [:args],
78
- [:scope, [:block, [:super, [:lit, 24], [:lit, 42]]]]]
79
- end
62
+ [:defn,
63
+ :x,
64
+ [:args],
65
+ [:scope, [:block, [:super, [:lit, 24], [:lit, 42]]]]]
80
66
  end
81
67
 
82
- relates "super([*[1]])" do
83
- parse do
84
- [:super, [:array, [:splat, [:array, [:lit, 1]]]]]
85
- end
68
+ parse "super([*[1]])" do
69
+ [:super, [:splat, [:array, [:lit, 1]]]]
86
70
  end
87
71
 
88
- relates "super(*[1])" do
89
- parse do
90
- [:super, [:splat, [:array, [:lit, 1]]]]
91
- end
72
+ parse "super(*[1])" do
73
+ [:super, [:splat, [:array, [:lit, 1]]]]
92
74
  end
93
75
  end
data/spec/true_spec.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  describe "A True node" do
2
- relates "true" do
3
- parse do
4
- [:true]
5
- end
2
+ parse "true" do
3
+ [:true]
6
4
  end
7
5
  end
data/spec/undef_spec.rb CHANGED
@@ -1,98 +1,83 @@
1
1
  describe "An Undef node" do
2
- relates "undef :x" do
3
- parse do
4
- [:undef, [:lit, :x]]
5
- end
2
+ parse "undef :x" do
3
+ [:undef, [:lit, :x]]
6
4
  end
7
5
 
8
- relates "undef :x, :y" do
9
- parse do
10
- [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]
11
- end
6
+ parse "undef :x, :y" do
7
+ [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]
12
8
  end
13
9
 
14
- relates "undef :x, :y, :z" do
15
- parse do
16
- [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]
17
- end
10
+ parse "undef :x, :y, :z" do
11
+ [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]
18
12
  end
19
13
 
20
- relates <<-ruby do
14
+ parse <<-ruby do
21
15
  f1
22
16
  undef :x
23
17
  ruby
24
18
 
25
- parse do
26
- [:block, [:call, nil, :f1, [:arglist]], [:undef, [:lit, :x]]]
27
- end
19
+ [:block, [:call, nil, :f1, [:arglist]], [:undef, [:lit, :x]]]
28
20
  end
29
21
 
30
- relates <<-ruby do
22
+ parse <<-ruby do
31
23
  f1
32
24
  undef :x, :y
33
25
  ruby
34
26
 
35
- parse do
36
- [:block,
37
- [:call, nil, :f1, [:arglist]],
38
- [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]]
39
- end
27
+ [:block,
28
+ [:call, nil, :f1, [:arglist]],
29
+ [:undef, [:lit, :x]],
30
+ [:undef, [:lit, :y]]]
40
31
  end
41
32
 
42
- relates <<-ruby do
33
+ parse <<-ruby do
43
34
  undef :x, :y, :z
44
35
  f2
45
36
  ruby
46
37
 
47
- parse do
48
- [:block,
49
- [:undef, [:lit, :x]],
50
- [:undef, [:lit, :y]],
51
- [:undef, [:lit, :z]],
52
- [:call, nil, :f2, [:arglist]]]
53
- end
38
+ [:block,
39
+ [:undef, [:lit, :x]],
40
+ [:undef, [:lit, :y]],
41
+ [:undef, [:lit, :z]],
42
+ [:call, nil, :f2, [:arglist]]]
54
43
  end
55
44
 
56
- relates <<-ruby do
45
+ parse <<-ruby do
57
46
  f1
58
47
  undef :x, :y, :z
59
48
  ruby
60
49
 
61
- parse do
62
- [:block,
63
- [:call, nil, :f1, [:arglist]],
64
- [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]]
65
- end
50
+ [:block,
51
+ [:call, nil, :f1, [:arglist]],
52
+ [:undef, [:lit, :x]],
53
+ [:undef, [:lit, :y]],
54
+ [:undef, [:lit, :z]]]
66
55
  end
67
56
 
68
- relates <<-ruby do
57
+ parse <<-ruby do
69
58
  f1
70
59
  undef :x, :y, :z
71
60
  f2
72
61
  ruby
73
62
 
74
- parse do
75
- [:block,
76
- [:call, nil, :f1, [:arglist]],
77
- [:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]],
78
- [:call, nil, :f2, [:arglist]]]
79
- end
63
+ [:block,
64
+ [:call, nil, :f1, [:arglist]],
65
+ [:undef, [:lit, :x]],
66
+ [:undef, [:lit, :y]],
67
+ [:undef, [:lit, :z]],
68
+ [:call, nil, :f2, [:arglist]]]
80
69
  end
81
70
 
82
- relates "class B; undef :blah; end" do
83
- parse do
84
- [:class, :B, nil, [:scope, [:undef, [:lit, :blah]]]]
85
- end
71
+ parse "class B; undef :blah; end" do
72
+ [:class, :B, nil, [:scope, [:block, [:undef, [:lit, :blah]]]]]
86
73
  end
87
74
 
88
- relates <<-ruby do
75
+ parse <<-ruby do
89
76
  undef :"x\#{1}", :"x\#{2}"
90
77
  ruby
91
78
 
92
- parse do
93
- [:block,
94
- [:undef, [:dsym, "x", [:evstr, [:lit, 1]]]],
95
- [:undef, [:dsym, "x", [:evstr, [:lit, 2]]]]]
96
- end
79
+ [:block,
80
+ [:undef, [:dsym, "x", [:evstr, [:lit, 1]]]],
81
+ [:undef, [:dsym, "x", [:evstr, [:lit, 2]]]]]
97
82
  end
98
83
  end