diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 14 | ||||
-rw-r--r-- | test/ruby/test_unicode_escape.rb | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 49ecfc56ed..14990be12c 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -491,14 +491,16 @@ class TestParse < Test::Unit::TestCase end def test_symbol - assert_raise(SyntaxError) do - eval ":'foo\0bar'" + bug = '[ruby-dev:41447]' + sym = "foo\0bar".to_sym + assert_nothing_raised(SyntaxError, bug) do + assert_equal(sym, eval(":'foo\0bar'")) end - assert_raise(SyntaxError) do - eval ':"foo\u0000bar"' + assert_nothing_raised(SyntaxError, bug) do + assert_equal(sym, eval(':"foo\u0000bar"')) end - assert_raise(SyntaxError) do - eval ':"foo\u{0}bar"' + assert_nothing_raised(SyntaxError, bug) do + assert_equal(sym, eval(':"foo\u{0}bar"')) end assert_raise(SyntaxError) do eval ':"foo\u{}bar"' diff --git a/test/ruby/test_unicode_escape.rb b/test/ruby/test_unicode_escape.rb index 5887dbc3dc..088f81ce14 100644 --- a/test/ruby/test_unicode_escape.rb +++ b/test/ruby/test_unicode_escape.rb @@ -57,12 +57,14 @@ EOS assert_equal(:"\u{41}", :"\u0041") assert_equal(:ΓΌ, :"\u{fc}") - # the NUL character is not allowed in symbols - assert_raise(SyntaxError) { eval %q(:"\u{0}")} - assert_raise(SyntaxError) { eval %q(:"\u0000")} - assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")} - assert_raise(SyntaxError) { eval %q(:"\x00")} - assert_raise(SyntaxError) { eval %q(:"\0")} + # the NUL character is allowed in symbols + bug = '[ruby-dev:41447]' + sym = "\0".to_sym + assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\u{0}")))} + assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\u0000")))} + assert_nothing_raised(SyntaxError, bug) {assert_equal("\u{fc}\0A".to_sym, eval(%q(:"\u{fc 0 0041}")))} + assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\x00")))} + assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\0")))} end def test_regexp |