diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-16 11:35:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-16 11:35:27 +0000 |
commit | 019f21e58037992741fd407e9c124a5b1b51551f (patch) | |
tree | 9350bbabc987334ca464eedcbbecc1e2a59873c1 /test/ruby | |
parent | 70af8d3c9ca2a46ef1f364783125a747d9426b2b (diff) | |
download | ruby-019f21e58037992741fd407e9c124a5b1b51551f.tar.gz |
Use assert_syntax_error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_parse.rb | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 46d9470287..aea1f4bf5c 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -486,24 +486,16 @@ class TestParse < Test::Unit::TestCase def test_string mesg = 'from the backslash through the invalid char' - e = assert_raise_with_message(SyntaxError, /hex escape/) do - eval '"\xg1"' - end + e = assert_syntax_error('"\xg1"', /hex escape/) assert_equal(' ^', e.message.lines.last, mesg) - e = assert_raise(SyntaxError) do - eval '"\u{1234"' - end + e = assert_syntax_error('"\u{1234"', 'Unicode escape') assert_match(' ^~~~~~~', e.message.lines.last, mesg) - e = assert_raise_with_message(SyntaxError, /escape character syntax/) do - eval '"\M1"' - end + e = assert_syntax_error('"\M1"', /escape character syntax/) assert_equal(' ^~~', e.message.lines.last, mesg) - e = assert_raise_with_message(SyntaxError, /escape character syntax/) do - eval '"\C1"' - end + e = assert_syntax_error('"\C1"', /escape character syntax/) assert_equal(' ^~~', e.message.lines.last, mesg) assert_equal("\x81", eval('"\C-\M-a"')) |