Permalink
Browse files

- 1.8.6p287 & 1.8.7 removed the begin node. fixed.

[git-p4: depot-paths = "//src/ParseTree/dev/": change = 4971]
  • Loading branch information...
1 parent 9a16804 commit 0abdde54630cb5f5a522a24dd91c6ee34d7d3239 @zenspider zenspider committed May 25, 2009
Showing with 174 additions and 195 deletions.
  1. +101 −122 test/pt_testcase.rb
  2. +73 −73 test/test_parse_tree.rb
View
@@ -370,8 +370,7 @@ def self.unsupported_tests *tests
add_tests("begin",
"Ruby" => "begin\n (1 + 1)\nend",
- "RawParseTree" => [:begin,
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]]],
+ "RawParseTree" => [:call, [:lit, 1], :+, [:array, [:lit, 1]]],
"ParseTree" => s(:call, s(:lit, 1), :+,
s(:arglist, s(:lit, 1))),
"Ruby2Ruby" => "(1 + 1)")
@@ -385,12 +384,11 @@ def self.unsupported_tests *tests
add_tests("begin_rescue_ensure",
"Ruby" => "begin\n a\nrescue\n # do nothing\nensure\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:ensure,
- [:rescue,
- [:vcall, :a],
- [:resbody, nil]],
- [:nil]]],
+ "RawParseTree" => [:ensure,
+ [:rescue,
+ [:vcall, :a],
+ [:resbody, nil]],
+ [:nil]],
"ParseTree" => s(:ensure,
s(:rescue,
s(:call, nil, :a, s(:arglist)),
@@ -399,11 +397,10 @@ def self.unsupported_tests *tests
add_tests("begin_rescue_ensure_all_empty",
"Ruby" => "begin\n # do nothing\nrescue\n # do nothing\nensure\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:ensure,
- [:rescue,
- [:resbody, nil]],
- [:nil]]],
+ "RawParseTree" => [:ensure,
+ [:rescue,
+ [:resbody, nil]],
+ [:nil]],
"ParseTree" => s(:ensure,
s(:rescue,
s(:resbody, s(:array), nil)),
@@ -412,16 +409,14 @@ def self.unsupported_tests *tests
add_tests("begin_rescue_twice",
"Ruby" => "begin\n a\nrescue => mes\n # do nothing\nend\nbegin\n b\nrescue => mes\n # do nothing\nend\n",
"RawParseTree" => [:block,
- [:begin,
- [:rescue,
- [:vcall, :a],
- [:resbody, nil,
- [:lasgn, :mes, [:gvar, :$!]]]]],
- [:begin,
- [:rescue,
- [:vcall, :b],
- [:resbody, nil,
- [:lasgn, :mes, [:gvar, :$!]]]]]],
+ [:rescue,
+ [:vcall, :a],
+ [:resbody, nil,
+ [:lasgn, :mes, [:gvar, :$!]]]],
+ [:rescue,
+ [:vcall, :b],
+ [:resbody, nil,
+ [:lasgn, :mes, [:gvar, :$!]]]]],
"ParseTree" => s(:block,
s(:rescue,
s(:call, nil, :a, s(:arglist)),
@@ -441,11 +436,10 @@ def self.unsupported_tests *tests
[:vcall, :a],
[:resbody, nil,
[:lasgn, :mes, [:gvar, :$!]]]],
- [:begin,
- [:rescue,
- [:vcall, :b],
- [:resbody, nil,
- [:lasgn, :mes, [:gvar, :$!]]]]]])
+ [:rescue,
+ [:vcall, :b],
+ [:resbody, nil,
+ [:lasgn, :mes, [:gvar, :$!]]]]])
copy_test_case "begin_rescue_twice", "Ruby"
copy_test_case "begin_rescue_twice", "ParseTree"
@@ -665,10 +659,9 @@ def self.unsupported_tests *tests
[:scope,
[:block,
[:args],
- [:begin,
- [:rescue,
- [:vcall, :b],
- [:resbody, nil, [:vcall, :c]]]],
+ [:rescue,
+ [:vcall, :b],
+ [:resbody, nil, [:vcall, :c]]],
[:vcall, :d]]]],
"ParseTree" => s(:defn, :f,
s(:args),
@@ -703,9 +696,8 @@ def self.unsupported_tests *tests
[:block,
[:args],
[:vcall, :a],
- [:begin,
- [:rescue, [:vcall, :b],
- [:resbody, nil, [:vcall, :c]]]]]]],
+ [:rescue, [:vcall, :b],
+ [:resbody, nil, [:vcall, :c]]]]]],
"ParseTree" => s(:defn, :f,
s(:args),
s(:scope,
@@ -730,12 +722,11 @@ def self.unsupported_tests *tests
[:block,
[:args],
[:vcall, :a],
- [:begin,
- [:rescue,
- [:vcall, :b],
- [:resbody,
- nil,
- [:vcall, :c]]]],
+ [:rescue,
+ [:vcall, :b],
+ [:resbody,
+ nil,
+ [:vcall, :c]]],
[:vcall, :d]]]],
"ParseTree" => s(:defn, :f, s(:args),
s(:scope,
@@ -1422,14 +1413,13 @@ def self.unsupported_tests *tests
[:fcall, :assert_block,
[:array, [:vcall, :full_message]]],
nil,
- [:begin,
- [:rescue,
- [:yield],
- [:resbody,
- [:array, [:const, :Exception]],
- [:block,
- [:dasgn, :v,
- [:gvar, :$!]], [:break]]]]]]]],
+ [:rescue,
+ [:yield],
+ [:resbody,
+ [:array, [:const, :Exception]],
+ [:block,
+ [:dasgn, :v,
+ [:gvar, :$!]], [:break]]]]]]],
"ParseTree" => s(:iter,
s(:call, nil, :a, s(:arglist)),
nil,
@@ -2170,20 +2160,19 @@ def self.unsupported_tests *tests
add_tests("ensure",
"Ruby" => "begin\n (1 + 1)\nrescue SyntaxError => e1\n 2\nrescue Exception => e2\n 3\nelse\n 4\nensure\n 5\nend",
- "RawParseTree" => [:begin,
- [:ensure,
- [:rescue,
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]],
+ "RawParseTree" => [:ensure,
+ [:rescue,
+ [:call, [:lit, 1], :+, [:array, [:lit, 1]]],
+ [:resbody,
+ [:array, [:const, :SyntaxError]],
+ [:block,
+ [:lasgn, :e1, [:gvar, :$!]], [:lit, 2]],
[:resbody,
- [:array, [:const, :SyntaxError]],
+ [:array, [:const, :Exception]],
[:block,
- [:lasgn, :e1, [:gvar, :$!]], [:lit, 2]],
- [:resbody,
- [:array, [:const, :Exception]],
- [:block,
- [:lasgn, :e2, [:gvar, :$!]], [:lit, 3]]]],
- [:lit, 4]],
- [:lit, 5]]],
+ [:lasgn, :e2, [:gvar, :$!]], [:lit, 3]]]],
+ [:lit, 4]],
+ [:lit, 5]],
"ParseTree" => s(:ensure,
s(:rescue,
s(:call, s(:lit, 1), :+,
@@ -2910,15 +2899,14 @@ def self.unsupported_tests *tests
[:iter,
[:fcall, :c],
nil,
- [:begin,
- [:rescue,
- [:vcall, :do_stuff],
- [:resbody,
- [:array, [:const, :RuntimeError]],
- [:block,
- [:dasgn_curr, :b, [:gvar, :$!]],
- [:fcall, :puts,
- [:array, [:dvar, :b]]]]]]]]]]]],
+ [:rescue,
+ [:vcall, :do_stuff],
+ [:resbody,
+ [:array, [:const, :RuntimeError]],
+ [:block,
+ [:dasgn_curr, :b, [:gvar, :$!]],
+ [:fcall, :puts,
+ [:array, [:dvar, :b]]]]]]]]]]],
"ParseTree" => s(:block,
s(:lasgn, :b, s(:lit, 42)),
s(:defn, :a,
@@ -3590,14 +3578,13 @@ def self.unsupported_tests *tests
add_tests("rescue_block_body",
"Ruby" => "begin\n a\nrescue => e\n c\n d\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:vcall, :a],
- [:resbody, nil,
- [:block,
- [:lasgn, :e, [:gvar, :$!]],
- [:vcall, :c],
- [:vcall, :d]]]]],
+ "RawParseTree" => [:rescue,
+ [:vcall, :a],
+ [:resbody, nil,
+ [:block,
+ [:lasgn, :e, [:gvar, :$!]],
+ [:vcall, :c],
+ [:vcall, :d]]]],
"ParseTree" => s(:rescue,
s(:call, nil, :a, s(:arglist)),
s(:resbody,
@@ -3608,15 +3595,14 @@ def self.unsupported_tests *tests
add_tests("rescue_block_body_3",
"Ruby" => "begin\n a\nrescue A\n b\nrescue B\n c\nrescue C\n d\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:vcall, :a],
- [:resbody, [:array, [:const, :A]],
- [:vcall, :b],
- [:resbody, [:array, [:const, :B]],
- [:vcall, :c],
- [:resbody, [:array, [:const, :C]],
- [:vcall, :d]]]]]],
+ "RawParseTree" => [:rescue,
+ [:vcall, :a],
+ [:resbody, [:array, [:const, :A]],
+ [:vcall, :b],
+ [:resbody, [:array, [:const, :B]],
+ [:vcall, :c],
+ [:resbody, [:array, [:const, :C]],
+ [:vcall, :d]]]]],
"ParseTree" => s(:rescue,
s(:call, nil, :a, s(:arglist)),
s(:resbody, s(:array, s(:const, :A)),
@@ -3628,14 +3614,13 @@ def self.unsupported_tests *tests
add_tests("rescue_block_body_ivar",
"Ruby" => "begin\n a\nrescue => @e\n c\n d\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:vcall, :a],
- [:resbody, nil,
- [:block,
- [:iasgn, :@e, [:gvar, :$!]],
- [:vcall, :c],
- [:vcall, :d]]]]],
+ "RawParseTree" => [:rescue,
+ [:vcall, :a],
+ [:resbody, nil,
+ [:block,
+ [:iasgn, :@e, [:gvar, :$!]],
+ [:vcall, :c],
+ [:vcall, :d]]]],
"ParseTree" => s(:rescue,
s(:call, nil, :a, s(:arglist)),
s(:resbody,
@@ -3646,20 +3631,18 @@ def self.unsupported_tests *tests
add_tests("rescue_block_nada",
"Ruby" => "begin\n blah\nrescue\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:rescue, [:vcall, :blah], [:resbody, nil]]],
+ "RawParseTree" => [:rescue, [:vcall, :blah], [:resbody, nil]],
"ParseTree" => s(:rescue,
s(:call, nil, :blah, s(:arglist)),
s(:resbody, s(:array), nil)))
add_tests("rescue_exceptions",
"Ruby" => "begin\n blah\nrescue RuntimeError => r\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:vcall, :blah],
- [:resbody,
- [:array, [:const, :RuntimeError]],
- [:lasgn, :r, [:gvar, :$!]]]]],
+ "RawParseTree" => [:rescue,
+ [:vcall, :blah],
+ [:resbody,
+ [:array, [:const, :RuntimeError]],
+ [:lasgn, :r, [:gvar, :$!]]]],
"ParseTree" => s(:rescue,
s(:call, nil, :blah, s(:arglist)),
s(:resbody,
@@ -3671,10 +3654,9 @@ def self.unsupported_tests *tests
add_tests("rescue_iasgn_var_empty",
"Ruby" => "begin\n 1\nrescue => @e\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:lit, 1],
- [:resbody, nil, [:iasgn, :@e, [:gvar, :$!]]]]],
+ "RawParseTree" => [:rescue,
+ [:lit, 1],
+ [:resbody, nil, [:iasgn, :@e, [:gvar, :$!]]]],
"ParseTree" => s(:rescue,
s(:lit, 1),
s(:resbody,
@@ -3683,10 +3665,9 @@ def self.unsupported_tests *tests
add_tests("rescue_lasgn",
"Ruby" => "begin\n 1\nrescue\n var = 2\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:lit, 1],
- [:resbody, nil, [:lasgn, :var, [:lit, 2]]]]],
+ "RawParseTree" => [:rescue,
+ [:lit, 1],
+ [:resbody, nil, [:lasgn, :var, [:lit, 2]]]],
"ParseTree" => s(:rescue,
s(:lit, 1),
s(:resbody,
@@ -3696,13 +3677,12 @@ def self.unsupported_tests *tests
add_tests("rescue_lasgn_var",
"Ruby" => "begin\n 1\nrescue => e\n var = 2\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:lit, 1],
- [:resbody, nil,
- [:block,
- [:lasgn, :e, [:gvar, :$!]],
- [:lasgn, :var, [:lit, 2]]]]]],
+ "RawParseTree" => [:rescue,
+ [:lit, 1],
+ [:resbody, nil,
+ [:block,
+ [:lasgn, :e, [:gvar, :$!]],
+ [:lasgn, :var, [:lit, 2]]]]],
"ParseTree" => s(:rescue,
s(:lit, 1),
s(:resbody,
@@ -3711,10 +3691,9 @@ def self.unsupported_tests *tests
add_tests("rescue_lasgn_var_empty",
"Ruby" => "begin\n 1\nrescue => e\n # do nothing\nend",
- "RawParseTree" => [:begin,
- [:rescue,
- [:lit, 1],
- [:resbody, nil, [:lasgn, :e, [:gvar, :$!]]]]],
+ "RawParseTree" => [:rescue,
+ [:lit, 1],
+ [:resbody, nil, [:lasgn, :e, [:gvar, :$!]]]],
"ParseTree" => s(:rescue,
s(:lit, 1),
s(:resbody,
Oops, something went wrong.

0 comments on commit 0abdde5

Please sign in to comment.