ruby-changes:47227
From: nobu <ko1@a...>
Date: Sun, 16 Jul 2017 20:35:32 +0900 (JST)
Subject: [ruby-changes:47227] nobu:r59342 (trunk): Use assert_syntax_error
nobu 2017-07-16 20:35:27 +0900 (Sun, 16 Jul 2017) New Revision: 59342 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59342 Log: Use assert_syntax_error Modified files: trunk/test/ruby/test_parse.rb Index: test/ruby/test_parse.rb =================================================================== --- test/ruby/test_parse.rb (revision 59341) +++ test/ruby/test_parse.rb (revision 59342) @@ -486,24 +486,16 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L486 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"')) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/