diff options
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r-- | test/ruby/test_parse.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 80debd7699..5f8689c6ec 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -6,7 +6,6 @@ require 'stringio' class TestParse < Test::Unit::TestCase def setup @verbose = $VERBOSE - $VERBOSE = nil end def teardown @@ -399,7 +398,6 @@ class TestParse < Test::Unit::TestCase def test_arg2 o = Object.new - assert_nothing_raised do eval <<-END, nil, __FILE__, __LINE__+1 def o.foo(a=42,*r,z,&b); b.call(r.inject(a*1000+z*100, :+)); end @@ -411,6 +409,7 @@ class TestParse < Test::Unit::TestCase assert_equal(-42100, o.foo(1) {|x| -x }) assert_raise(ArgumentError) { o.foo() } + o = Object.new assert_nothing_raised do eval <<-END, nil, __FILE__, __LINE__+1 def o.foo(a=42,z,&b); b.call(a*1000+z*100); end @@ -420,6 +419,7 @@ class TestParse < Test::Unit::TestCase assert_equal(-42100, o.foo(1) {|x| -x } ) assert_raise(ArgumentError) { o.foo() } + o = Object.new assert_nothing_raised do eval <<-END, nil, __FILE__, __LINE__+1 def o.foo(*r,z,&b); b.call(r.inject(z*100, :+)); end @@ -724,13 +724,13 @@ x = __ENCODING__ end def test_float - assert_equal(1.0/0, eval("1e10000")) + assert_predicate(assert_warning(/out of range/) {eval("1e10000")}, :infinite?) assert_syntax_error('1_E', /trailing `_'/) assert_syntax_error('1E1E1', /unexpected constant/) end def test_global_variable - assert_equal(nil, eval('$-x')) + assert_equal(nil, assert_warning(/not initialized/) {eval('$-x')}) assert_equal(nil, eval('alias $preserve_last_match $&')) assert_equal(nil, eval('alias $& $test_parse_foobarbazqux')) $test_parse_foobarbazqux = nil @@ -823,13 +823,13 @@ x = __ENCODING__ end def test_assign_in_conditional - assert_nothing_raised do + assert_warning(/`= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 (x, y = 1, 2) ? 1 : 2 END end - assert_nothing_raised do + assert_warning(/`= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 if @x = true 1 @@ -841,13 +841,13 @@ x = __ENCODING__ end def test_literal_in_conditional - assert_nothing_raised do + assert_warning(/string literal in condition/) do eval <<-END, nil, __FILE__, __LINE__+1 "foo" ? 1 : 2 END end - assert_nothing_raised do + assert_warning(/regex literal in condition/) do x = "bar" eval <<-END, nil, __FILE__, __LINE__+1 /foo#{x}baz/ ? 1 : 2 @@ -860,13 +860,13 @@ x = __ENCODING__ END end - assert_nothing_raised do + assert_warning(/string literal in flip-flop/) do eval <<-END, nil, __FILE__, __LINE__+1 ("foo".."bar") ? 1 : 2 END end - assert_nothing_raised do + assert_warning(/literal in condition/) do x = "bar" eval <<-END, nil, __FILE__, __LINE__+1 :"foo#{"x"}baz" ? 1 : 2 |