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 | e6c756320534b99866252311063eb1b0d3766f87 (patch) | |
tree | 9350bbabc987334ca464eedcbbecc1e2a59873c1 /test | |
parent | 1b27045a1514218140f0cecb0e928f2f2a9a4194 (diff) | |
download | ruby-e6c756320534b99866252311063eb1b0d3766f87.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')
-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"')) |