rubinius-melbourne 2.0.0.19 → 2.0.1.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 +14 -0
- data/Gemfile +4 -0
- data/Rakefile +31 -0
- data/ext/rubinius/melbourne/extconf.rb +9 -2
- data/lib/rubinius/melbourne.rb +1 -1
- data/lib/rubinius/melbourne/version.rb +1 -1
- data/rubinius-melbourne.gemspec +5 -3
- data/spec/alias_spec.rb +40 -0
- data/spec/and_spec.rb +19 -0
- data/spec/array_spec.rb +81 -0
- data/spec/attrasgn_spec.rb +112 -0
- data/spec/back_ref_spec.rb +11 -0
- data/spec/call_spec.rb +298 -0
- data/spec/case_spec.rb +234 -0
- data/spec/cdecl_spec.rb +45 -0
- data/spec/class_spec.rb +83 -0
- data/spec/colon2_spec.rb +7 -0
- data/spec/colon3_spec.rb +7 -0
- data/spec/const_spec.rb +7 -0
- data/spec/custom/matchers/parse_as.rb +27 -0
- data/spec/custom/runner/relates.rb +83 -0
- data/spec/cvar_spec.rb +29 -0
- data/spec/cvasgn_spec.rb +30 -0
- data/spec/cvdecl_spec.rb +12 -0
- data/spec/default.mspec +4 -0
- data/spec/defined_spec.rb +117 -0
- data/spec/defn_spec.rb +554 -0
- data/spec/defs_spec.rb +81 -0
- data/spec/dot2_spec.rb +7 -0
- data/spec/dot3_spec.rb +7 -0
- data/spec/dregx_spec.rb +52 -0
- data/spec/dstr_spec.rb +169 -0
- data/spec/dsym_spec.rb +10 -0
- data/spec/dxstr_spec.rb +11 -0
- data/spec/ensure_spec.rb +117 -0
- data/spec/false_spec.rb +7 -0
- data/spec/flip2_spec.rb +43 -0
- data/spec/flip3_spec.rb +27 -0
- data/spec/for_spec.rb +61 -0
- data/spec/gasgn_spec.rb +13 -0
- data/spec/gvar_spec.rb +25 -0
- data/spec/hash_spec.rb +31 -0
- data/spec/iasgn_spec.rb +25 -0
- data/spec/if_spec.rb +131 -0
- data/spec/iter_spec.rb +613 -0
- data/spec/lasgn_spec.rb +377 -0
- data/spec/lit_spec.rb +61 -0
- data/spec/masgn_spec.rb +406 -0
- data/spec/match2_spec.rb +19 -0
- data/spec/match3_spec.rb +24 -0
- data/spec/match_spec.rb +7 -0
- data/spec/module_spec.rb +47 -0
- data/spec/nil_spec.rb +7 -0
- data/spec/not_spec.rb +17 -0
- data/spec/nth_ref_spec.rb +7 -0
- data/spec/op_asgn_spec.rb +246 -0
- data/spec/or_spec.rb +35 -0
- data/spec/postexe_spec.rb +7 -0
- data/spec/regex_spec.rb +28 -0
- data/spec/rescue_spec.rb +359 -0
- data/spec/return_spec.rb +57 -0
- data/spec/sclass_spec.rb +55 -0
- data/spec/str_spec.rb +97 -0
- data/spec/super_spec.rb +93 -0
- data/spec/true_spec.rb +7 -0
- data/spec/undef_spec.rb +98 -0
- data/spec/until_spec.rb +140 -0
- data/spec/valias_spec.rb +7 -0
- data/spec/while_spec.rb +192 -0
- data/spec/xstr_spec.rb +7 -0
- data/spec/yield_spec.rb +65 -0
- data/spec/zsuper_spec.rb +45 -0
- metadata +171 -13
data/spec/str_spec.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
describe "A Str node" do
|
2
|
+
relates '"x"' do
|
3
|
+
parse do
|
4
|
+
[:str, "x"]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
relates <<-ruby do
|
9
|
+
"before" \
|
10
|
+
" after"
|
11
|
+
ruby
|
12
|
+
|
13
|
+
parse do
|
14
|
+
[:str, "before after"]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
relates '"before" " after"' do
|
19
|
+
parse do
|
20
|
+
[:str, "before after"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
relates <<-ruby do
|
25
|
+
"file = \#{__FILE__}\n"
|
26
|
+
ruby
|
27
|
+
|
28
|
+
parse do
|
29
|
+
[:dstr, "file = ", [:evstr, [:file]], [:str, "\n"]]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
relates <<-ruby do
|
34
|
+
<<'EOM'.strip
|
35
|
+
blah
|
36
|
+
blah
|
37
|
+
EOM
|
38
|
+
ruby
|
39
|
+
|
40
|
+
parse do
|
41
|
+
[:call, [:str, " blah\nblah\n"], :strip, [:arglist]]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
relates <<-ruby do
|
46
|
+
a += <<-H1 + b + <<-H2
|
47
|
+
first
|
48
|
+
H1
|
49
|
+
second
|
50
|
+
H2
|
51
|
+
ruby
|
52
|
+
|
53
|
+
parse do
|
54
|
+
[:lasgn,
|
55
|
+
:a,
|
56
|
+
[:call,
|
57
|
+
[:lvar, :a],
|
58
|
+
:+,
|
59
|
+
[:arglist,
|
60
|
+
[:call,
|
61
|
+
[:call, [:str, " first\n"], :+, [:arglist, [:call, nil, :b, [:arglist]]]],
|
62
|
+
:+,
|
63
|
+
[:arglist, [:str, " second\n"]]]]]]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
relates <<-ruby do
|
68
|
+
<<-EOM
|
69
|
+
blah
|
70
|
+
blah
|
71
|
+
|
72
|
+
EOM
|
73
|
+
ruby
|
74
|
+
|
75
|
+
parse do
|
76
|
+
[:str, " blah\nblah\n\n"]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
relates <<-ruby do
|
81
|
+
<<'EOM'
|
82
|
+
blah
|
83
|
+
blah
|
84
|
+
EOM
|
85
|
+
ruby
|
86
|
+
|
87
|
+
parse do
|
88
|
+
[:str, " blah\nblah\n"]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
relates "%(blah)" do
|
93
|
+
parse do
|
94
|
+
[:str, "blah"]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/spec/super_spec.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
describe "A Super node" do
|
2
|
+
relates <<-ruby do
|
3
|
+
def x
|
4
|
+
super()
|
5
|
+
end
|
6
|
+
ruby
|
7
|
+
|
8
|
+
parse do
|
9
|
+
[:defn, :x, [:args], [:scope, [:block, [:super]]]]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
relates <<-ruby do
|
14
|
+
def x(&block)
|
15
|
+
super(&block)
|
16
|
+
end
|
17
|
+
ruby
|
18
|
+
|
19
|
+
parse do
|
20
|
+
[:defn,
|
21
|
+
:x,
|
22
|
+
[:args, :"&block"],
|
23
|
+
[:scope, [:block, [:super, [:block_pass, [:lvar, :block]]]]]]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
relates <<-ruby do
|
28
|
+
def x
|
29
|
+
super([24, 42])
|
30
|
+
end
|
31
|
+
ruby
|
32
|
+
|
33
|
+
parse do
|
34
|
+
[:defn,
|
35
|
+
:x,
|
36
|
+
[:args],
|
37
|
+
[:scope, [:block, [:super, [:array, [:lit, 24], [:lit, 42]]]]]]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
relates <<-ruby do
|
42
|
+
def x
|
43
|
+
super(4)
|
44
|
+
end
|
45
|
+
ruby
|
46
|
+
|
47
|
+
parse do
|
48
|
+
[:defn, :x, [:args], [:scope, [:block, [:super, [:lit, 4]]]]]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
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
|
58
|
+
end
|
59
|
+
|
60
|
+
relates "super(a, *b)" do
|
61
|
+
parse do
|
62
|
+
[:super,
|
63
|
+
[:call, nil, :a, [:arglist]],
|
64
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
relates <<-ruby do
|
69
|
+
def x
|
70
|
+
super(24, 42)
|
71
|
+
end
|
72
|
+
ruby
|
73
|
+
|
74
|
+
parse do
|
75
|
+
[:defn,
|
76
|
+
:x,
|
77
|
+
[:args],
|
78
|
+
[:scope, [:block, [:super, [:lit, 24], [:lit, 42]]]]]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
relates "super([*[1]])" do
|
83
|
+
parse do
|
84
|
+
[:super, [:array, [:splat, [:array, [:lit, 1]]]]]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
relates "super(*[1])" do
|
89
|
+
parse do
|
90
|
+
[:super, [:splat, [:array, [:lit, 1]]]]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
data/spec/true_spec.rb
ADDED
data/spec/undef_spec.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
describe "An Undef node" do
|
2
|
+
relates "undef :x" do
|
3
|
+
parse do
|
4
|
+
[:undef, [:lit, :x]]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
relates "undef :x, :y" do
|
9
|
+
parse do
|
10
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
relates "undef :x, :y, :z" do
|
15
|
+
parse do
|
16
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
relates <<-ruby do
|
21
|
+
f1
|
22
|
+
undef :x
|
23
|
+
ruby
|
24
|
+
|
25
|
+
parse do
|
26
|
+
[:block, [:call, nil, :f1, [:arglist]], [:undef, [:lit, :x]]]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
relates <<-ruby do
|
31
|
+
f1
|
32
|
+
undef :x, :y
|
33
|
+
ruby
|
34
|
+
|
35
|
+
parse do
|
36
|
+
[:block,
|
37
|
+
[:call, nil, :f1, [:arglist]],
|
38
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
relates <<-ruby do
|
43
|
+
undef :x, :y, :z
|
44
|
+
f2
|
45
|
+
ruby
|
46
|
+
|
47
|
+
parse do
|
48
|
+
[:block,
|
49
|
+
[:undef, [:lit, :x]],
|
50
|
+
[:undef, [:lit, :y]],
|
51
|
+
[:undef, [:lit, :z]],
|
52
|
+
[:call, nil, :f2, [:arglist]]]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
relates <<-ruby do
|
57
|
+
f1
|
58
|
+
undef :x, :y, :z
|
59
|
+
ruby
|
60
|
+
|
61
|
+
parse do
|
62
|
+
[:block,
|
63
|
+
[:call, nil, :f1, [:arglist]],
|
64
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
relates <<-ruby do
|
69
|
+
f1
|
70
|
+
undef :x, :y, :z
|
71
|
+
f2
|
72
|
+
ruby
|
73
|
+
|
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
|
80
|
+
end
|
81
|
+
|
82
|
+
relates "class B; undef :blah; end" do
|
83
|
+
parse do
|
84
|
+
[:class, :B, nil, [:scope, [:undef, [:lit, :blah]]]]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
relates <<-ruby do
|
89
|
+
undef :"x\#{1}", :"x\#{2}"
|
90
|
+
ruby
|
91
|
+
|
92
|
+
parse do
|
93
|
+
[:block,
|
94
|
+
[:undef, [:dsym, "x", [:evstr, [:lit, 1]]]],
|
95
|
+
[:undef, [:dsym, "x", [:evstr, [:lit, 2]]]]]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/spec/until_spec.rb
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
describe "An Until node" do
|
2
|
+
pre_until_sexp = [
|
3
|
+
:until,
|
4
|
+
[:call, nil, :a, [:arglist]],
|
5
|
+
[:call, [:call, nil, :b, [:arglist]], :+, [:arglist, [:lit, 1]]],
|
6
|
+
true
|
7
|
+
]
|
8
|
+
|
9
|
+
relates <<-ruby do
|
10
|
+
while not a
|
11
|
+
b + 1
|
12
|
+
end
|
13
|
+
ruby
|
14
|
+
|
15
|
+
parse do
|
16
|
+
pre_until_sexp
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
relates "b + 1 while not a" do
|
21
|
+
parse do
|
22
|
+
pre_until_sexp
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
relates <<-ruby do
|
27
|
+
until a
|
28
|
+
b + 1
|
29
|
+
end
|
30
|
+
ruby
|
31
|
+
|
32
|
+
parse do
|
33
|
+
pre_until_sexp
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
relates "b + 1 until a" do
|
38
|
+
parse do
|
39
|
+
pre_until_sexp
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
post_until_sexp = [
|
44
|
+
:until,
|
45
|
+
[:call, nil, :a, [:arglist]],
|
46
|
+
[:call, [:call, nil, :b, [:arglist]], :+, [:arglist, [:lit, 1]]],
|
47
|
+
false
|
48
|
+
]
|
49
|
+
|
50
|
+
post_until = lambda do |g|
|
51
|
+
top = g.new_label
|
52
|
+
rdo = g.new_label
|
53
|
+
brk = g.new_label
|
54
|
+
bottom = g.new_label
|
55
|
+
|
56
|
+
g.push_modifiers
|
57
|
+
|
58
|
+
top.set!
|
59
|
+
|
60
|
+
g.push :self
|
61
|
+
g.send :b, 0, true
|
62
|
+
g.push 1
|
63
|
+
g.send :+, 1, false
|
64
|
+
g.pop
|
65
|
+
|
66
|
+
rdo.set!
|
67
|
+
|
68
|
+
g.push :self
|
69
|
+
g.send :a, 0, true
|
70
|
+
g.git bottom
|
71
|
+
|
72
|
+
g.check_interrupts
|
73
|
+
g.goto top
|
74
|
+
|
75
|
+
bottom.set!
|
76
|
+
g.push :nil
|
77
|
+
|
78
|
+
brk.set!
|
79
|
+
|
80
|
+
g.pop_modifiers
|
81
|
+
end
|
82
|
+
|
83
|
+
relates <<-ruby do
|
84
|
+
begin
|
85
|
+
b + 1
|
86
|
+
end while not a
|
87
|
+
ruby
|
88
|
+
|
89
|
+
parse do
|
90
|
+
post_until_sexp
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
relates <<-ruby do
|
95
|
+
begin
|
96
|
+
b + 1
|
97
|
+
end until a
|
98
|
+
ruby
|
99
|
+
|
100
|
+
parse do
|
101
|
+
post_until_sexp
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
nil_condition_sexp = [:until, [:nil], [:call, nil, :a, [:arglist]], true]
|
106
|
+
|
107
|
+
relates "a until ()" do
|
108
|
+
parse do
|
109
|
+
nil_condition_sexp
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
relates <<-ruby do
|
114
|
+
until ()
|
115
|
+
a
|
116
|
+
end
|
117
|
+
ruby
|
118
|
+
|
119
|
+
parse do
|
120
|
+
nil_condition_sexp
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
relates "a while not ()" do
|
125
|
+
parse do
|
126
|
+
nil_condition_sexp
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
relates <<-ruby do
|
131
|
+
while not ()
|
132
|
+
a
|
133
|
+
end
|
134
|
+
ruby
|
135
|
+
|
136
|
+
parse do
|
137
|
+
nil_condition_sexp
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|