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/defs_spec.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
describe "A Defs node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
def self.x(y)
|
4
4
|
(y + 1)
|
5
5
|
end
|
6
6
|
ruby
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
[:scope, [:block, [:call, [:lvar, :y], :+, [:arglist, [:lit, 1]]]]]]
|
14
|
-
end
|
8
|
+
[:defs,
|
9
|
+
[:self],
|
10
|
+
:x,
|
11
|
+
[:args, :y],
|
12
|
+
[:scope, [:block, [:call, [:lvar, :y], :+, [:arglist, [:lit, 1]]]]]]
|
15
13
|
end
|
16
14
|
|
17
|
-
|
15
|
+
parse <<-ruby do
|
18
16
|
def self.setup(ctx)
|
19
17
|
bind = allocate
|
20
18
|
bind.context = ctx
|
@@ -22,60 +20,54 @@ describe "A Defs node" do
|
|
22
20
|
end
|
23
21
|
ruby
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
[:return, [:lvar, :bind]]]]]
|
35
|
-
end
|
23
|
+
[:defs,
|
24
|
+
[:self],
|
25
|
+
:setup,
|
26
|
+
[:args, :ctx],
|
27
|
+
[:scope,
|
28
|
+
[:block,
|
29
|
+
[:lasgn, :bind, [:call, nil, :allocate, [:arglist]]],
|
30
|
+
[:attrasgn, [:lvar, :bind], :context=, [:arglist, [:lvar, :ctx]]],
|
31
|
+
[:return, [:lvar, :bind]]]]]
|
36
32
|
end
|
37
33
|
|
38
|
-
|
34
|
+
parse <<-ruby do
|
39
35
|
def self.empty(*)
|
40
36
|
end
|
41
37
|
ruby
|
42
38
|
|
43
|
-
|
44
|
-
[:defs, [:self], :empty, [:args, :*], [:scope, [:block]]]
|
45
|
-
end
|
39
|
+
[:defs, [:self], :empty, [:args, :*], [:scope, [:block, [:nil]]]]
|
46
40
|
end
|
47
41
|
|
48
|
-
|
42
|
+
parse <<-ruby do
|
49
43
|
def self.empty
|
50
44
|
end
|
51
45
|
ruby
|
52
46
|
|
53
|
-
|
54
|
-
[:defs, [:self], :empty, [:args], [:scope, [:block]]]
|
55
|
-
end
|
47
|
+
[:defs, [:self], :empty, [:args], [:scope, [:block, [:nil]]]]
|
56
48
|
end
|
57
49
|
|
58
|
-
|
50
|
+
parse <<-ruby do
|
59
51
|
def (a.b).empty(*)
|
60
52
|
end
|
61
53
|
ruby
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
[:scope, [:block]]]
|
69
|
-
end
|
55
|
+
[:defs,
|
56
|
+
[:call, [:call, nil, :a, [:arglist]], :b, [:arglist]],
|
57
|
+
:empty,
|
58
|
+
[:args, :*],
|
59
|
+
[:scope, [:block, [:nil]]]]
|
70
60
|
end
|
71
61
|
|
72
|
-
|
62
|
+
parse <<-ruby do
|
73
63
|
x = "a"
|
74
64
|
def x.m(a)
|
75
65
|
a
|
76
66
|
end
|
77
67
|
ruby
|
78
68
|
|
79
|
-
|
69
|
+
[:block,
|
70
|
+
[:lasgn, :x, [:str, "a"]],
|
71
|
+
[:defs, [:lvar, :x], :m, [:args, :a], [:scope, [:block, [:lvar, :a]]]]]
|
80
72
|
end
|
81
73
|
end
|
data/spec/dot2_spec.rb
CHANGED
data/spec/dot3_spec.rb
CHANGED
data/spec/dregx_spec.rb
CHANGED
@@ -1,52 +1,38 @@
|
|
1
1
|
describe "A Dregx node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
/(\#{})/
|
4
4
|
ruby
|
5
5
|
|
6
|
-
|
7
|
-
[:dregx, "(", [:str, ""], [:str, ")"]]
|
8
|
-
end
|
6
|
+
[:dregx, "(", [:evstr, [:nil]], [:str, ")"]]
|
9
7
|
end
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[:str, "y"]]
|
17
|
-
end
|
9
|
+
parse "/x\#{(1 + 1)}y/" do
|
10
|
+
[:dregx,
|
11
|
+
"x",
|
12
|
+
[:evstr, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
|
13
|
+
[:str, "y"]]
|
18
14
|
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
[:dregx, "a", [:str, ""], [:str, "b"]]
|
23
|
-
end
|
16
|
+
parse "/a\#{}b/" do
|
17
|
+
[:dregx, "a", [:evstr, [:nil]], [:str, "b"]]
|
24
18
|
end
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
[:dregx, "", [:evstr, [:ivar, :@rakefile]]]
|
29
|
-
end
|
20
|
+
parse "/\#{@rakefile}/" do
|
21
|
+
[:dregx, "", [:evstr, [:ivar, :@rakefile]]]
|
30
22
|
end
|
31
23
|
|
32
|
-
|
33
|
-
|
34
|
-
[:dregx, "", [:evstr, [:lit, 1]], 16]
|
35
|
-
end
|
24
|
+
parse "/\#{1}/n" do
|
25
|
+
[:dregx, "", [:evstr, [:lit, 1]], 512]
|
36
26
|
end
|
37
27
|
|
38
|
-
|
39
|
-
|
40
|
-
[:dregx_once, "", [:evstr, [:const, :IAC]], [:evstr, [:const, :SB]], 16]
|
41
|
-
end
|
28
|
+
parse "/\#{IAC}\#{SB}/no" do
|
29
|
+
[:dregx_once, "", [:evstr, [:const, :IAC]], [:evstr, [:const, :SB]], 512]
|
42
30
|
end
|
43
31
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
[:str, "y"]]
|
50
|
-
end
|
32
|
+
parse "/x\#{(1 + 1)}y/o" do
|
33
|
+
[:dregx_once,
|
34
|
+
"x",
|
35
|
+
[:evstr, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
|
36
|
+
[:str, "y"]]
|
51
37
|
end
|
52
38
|
end
|
data/spec/dstr_spec.rb
CHANGED
@@ -1,169 +1,145 @@
|
|
1
1
|
describe "A Dstr node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
"hello \#{}"
|
4
4
|
ruby
|
5
5
|
|
6
|
-
|
7
|
-
[:dstr, "hello ", [:str, ""]]
|
8
|
-
end
|
6
|
+
[:dstr, "hello ", [:evstr, [:nil]]]
|
9
7
|
end
|
10
8
|
|
11
|
-
|
9
|
+
parse <<-ruby do
|
12
10
|
argl = 1
|
13
11
|
"x\#{argl}y"
|
14
12
|
ruby
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
[:dstr, "x", [:evstr, [:lvar, :argl]], [:str, "y"]]]
|
20
|
-
end
|
14
|
+
[:block,
|
15
|
+
[:lasgn, :argl, [:lit, 1]],
|
16
|
+
[:dstr, "x", [:evstr, [:lvar, :argl]], [:str, "y"]]]
|
21
17
|
end
|
22
18
|
|
23
|
-
|
19
|
+
parse <<-ruby do
|
24
20
|
argl = 1
|
25
21
|
"x\#{("%.2f" % 3.14159)}y"
|
26
22
|
ruby
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
[:str, "y"]]]
|
35
|
-
end
|
24
|
+
[:block,
|
25
|
+
[:lasgn, :argl, [:lit, 1]],
|
26
|
+
[:dstr,
|
27
|
+
"x",
|
28
|
+
[:evstr, [:call, [:str, "%.2f"], :%, [:arglist, [:lit, 3.14159]]]],
|
29
|
+
[:str, "y"]]]
|
36
30
|
end
|
37
31
|
|
38
|
-
|
32
|
+
parse <<-ruby do
|
39
33
|
max = 2
|
40
34
|
argl = 1
|
41
35
|
"x\#{("%.\#{max}f" % 3.14159)}y"
|
42
36
|
ruby
|
43
37
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
[:str, "y"]]]
|
56
|
-
end
|
38
|
+
[:block,
|
39
|
+
[:lasgn, :max, [:lit, 2]],
|
40
|
+
[:lasgn, :argl, [:lit, 1]],
|
41
|
+
[:dstr,
|
42
|
+
"x",
|
43
|
+
[:evstr,
|
44
|
+
[:call,
|
45
|
+
[:dstr, "%.", [:evstr, [:lvar, :max]], [:str, "f"]],
|
46
|
+
:%,
|
47
|
+
[:arglist, [:lit, 3.14159]]]],
|
48
|
+
[:str, "y"]]]
|
57
49
|
end
|
58
50
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
[:evstr, [:lit, 66]]]
|
69
|
-
end
|
51
|
+
parse '"#{22}aa" "cd#{44}" "55" "#{66}"' do
|
52
|
+
[:dstr,
|
53
|
+
"",
|
54
|
+
[:evstr, [:lit, 22]],
|
55
|
+
[:str, "aa"],
|
56
|
+
[:str, "cd"],
|
57
|
+
[:evstr, [:lit, 44]],
|
58
|
+
[:str, "55"],
|
59
|
+
[:evstr, [:lit, 66]]]
|
70
60
|
end
|
71
61
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
[:str, " d"]]
|
82
|
-
end
|
62
|
+
parse '"a #$global b #@ivar c #@@cvar d"' do
|
63
|
+
[:dstr,
|
64
|
+
"a ",
|
65
|
+
[:evstr, [:gvar, :$global]],
|
66
|
+
[:str, " b "],
|
67
|
+
[:evstr, [:ivar, :@ivar]],
|
68
|
+
[:str, " c "],
|
69
|
+
[:evstr, [:cvar, :@@cvar]],
|
70
|
+
[:str, " d"]]
|
83
71
|
end
|
84
72
|
|
85
|
-
|
73
|
+
parse <<-ruby do
|
86
74
|
<<EOM
|
87
75
|
blah
|
88
76
|
\#{1 + 1}blah
|
89
77
|
EOM
|
90
78
|
ruby
|
91
79
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
[:str, "blah\n"]]
|
97
|
-
end
|
80
|
+
[:dstr,
|
81
|
+
" blah\n",
|
82
|
+
[:evstr, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
|
83
|
+
[:str, "blah\n"]]
|
98
84
|
end
|
99
85
|
|
100
|
-
|
86
|
+
parse <<-ruby do
|
101
87
|
<<-EOF
|
102
88
|
def test_\#{action}_valid_feed
|
103
89
|
EOF
|
104
90
|
ruby
|
105
91
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
[:str, "_valid_feed\n"]]
|
111
|
-
end
|
92
|
+
[:dstr,
|
93
|
+
"def test_",
|
94
|
+
[:evstr, [:call, nil, :action, [:arglist]]],
|
95
|
+
[:str, "_valid_feed\n"]]
|
112
96
|
end
|
113
97
|
|
114
|
-
|
98
|
+
parse <<-ruby do
|
115
99
|
<<-EOF
|
116
100
|
s1 '\#{RUBY_PLATFORM}' s2
|
117
101
|
\#{__FILE__}
|
118
102
|
EOF
|
119
103
|
ruby
|
120
104
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
[:str, "\n"]]
|
128
|
-
end
|
105
|
+
[:dstr,
|
106
|
+
"s1 '",
|
107
|
+
[:evstr, [:const, :RUBY_PLATFORM]],
|
108
|
+
[:str, "' s2\n"],
|
109
|
+
[:evstr, [:file]],
|
110
|
+
[:str, "\n"]]
|
129
111
|
end
|
130
112
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
[:str, "] after"]]
|
137
|
-
end
|
113
|
+
parse "%Q[before [\#{nest}] after]" do
|
114
|
+
[:dstr,
|
115
|
+
"before [",
|
116
|
+
[:evstr, [:call, nil, :nest, [:arglist]]],
|
117
|
+
[:str, "] after"]]
|
138
118
|
end
|
139
119
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
[:str, ")"]]
|
152
|
-
end
|
120
|
+
parse '"#{"blah"}#{__FILE__}:#{__LINE__}: warning: #{$!.message} (#{$!.class})"' do
|
121
|
+
[:dstr,
|
122
|
+
"blah",
|
123
|
+
[:evstr, [:file]],
|
124
|
+
[:str, ":"],
|
125
|
+
[:evstr, [:lit, 1]],
|
126
|
+
[:str, ": warning: "],
|
127
|
+
[:evstr, [:call, [:gvar, :$!], :message, [:arglist]]],
|
128
|
+
[:str, " ("],
|
129
|
+
[:evstr, [:call, [:gvar, :$!], :class, [:arglist]]],
|
130
|
+
[:str, ")"]]
|
153
131
|
end
|
154
132
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
[:str, ")"]]
|
167
|
-
end
|
133
|
+
parse '"before #{from} middle #{to} (#{__FILE__}:#{__LINE__})"' do
|
134
|
+
[:dstr,
|
135
|
+
"before ",
|
136
|
+
[:evstr, [:call, nil, :from, [:arglist]]],
|
137
|
+
[:str, " middle "],
|
138
|
+
[:evstr, [:call, nil, :to, [:arglist]]],
|
139
|
+
[:str, " ("],
|
140
|
+
[:evstr, [:file]],
|
141
|
+
[:str, ":"],
|
142
|
+
[:evstr, [:lit, 1]],
|
143
|
+
[:str, ")"]]
|
168
144
|
end
|
169
145
|
end
|