From 35f9cdb1ef994f6c90940d9f8487537d4c5aef39 Mon Sep 17 00:00:00 2001 From: Justin Collins Date: Wed, 19 Sep 2012 16:00:37 -0700 Subject: [PATCH] Add tests for `method_missing` fixes for Ruby2Ruby --- test/tests/test_sexp.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/tests/test_sexp.rb b/test/tests/test_sexp.rb index 2de7b9a5..b4bdf68d 100644 --- a/test/tests/test_sexp.rb +++ b/test/tests/test_sexp.rb @@ -243,4 +243,30 @@ class SexpTests < Test::Unit::TestCase assert_equal s(:arglist, s(:lit, 1)), exp.arglist assert_equal s(s(:lit, 1)), exp.args end + + def test_resbody_block + #Ruby2Ruby has calls like this which need to be supported + #for Brakeman::OutputProcessor + exp = parse "begin; rescue; end" + + assert_nil exp.resbody.block + end + + def test_lasgn + #Ruby2Ruby has calls like this which need to be supported + #for Brakeman::OutputProcessor + exp = parse "blah; x = 1" + + assert_equal s(:lasgn, :x, s(:lit, 1)), exp.lasgn(true) + assert_equal nil, exp.lasgn #Was deleted + end + + def test_iasgn + #Ruby2Ruby has calls like this which need to be supported + #for Brakeman::OutputProcessor + exp = parse "blah; @x = 1" + + assert_equal s(:iasgn, :@x, s(:lit, 1)), exp.iasgn(true) + assert_equal nil, exp.iasgn #Was deleted + end end -- GitLab