From 019f21e58037992741fd407e9c124a5b1b51551f Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 16 Jul 2017 11:35:27 +0000 Subject: [PATCH] Use assert_syntax_error git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_parse.rb | 16 ++++------------ 1 file 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"'))