diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-15 00:44:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-15 00:44:51 +0000 |
commit | 3134b20a0129aa072d1cb40a5000297333b5818d (patch) | |
tree | 0ce60d24b14d37645f335da6d0f08b306045463c /test/ruby/test_parse.rb | |
parent | bf4bcaf06115b32b5ffb4ddea972624d3ac7fa50 (diff) | |
download | ruby-3134b20a0129aa072d1cb40a5000297333b5818d.tar.gz |
Show the source line at an invalid class/instance variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r-- | test/ruby/test_parse.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 0b3657f8a0..d21484f4b6 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -720,13 +720,15 @@ x = __ENCODING__ end def test_invalid_instance_variable - assert_raise(SyntaxError) { eval('@#') } - assert_raise(SyntaxError) { eval('@') } + pattern = /without identifiers is not allowed as an instance variable name/ + assert_raise_with_message(SyntaxError, pattern) { eval('@%') } + assert_raise_with_message(SyntaxError, pattern) { eval('@') } end def test_invalid_class_variable - assert_raise(SyntaxError) { eval('@@1') } - assert_raise(SyntaxError) { eval('@@') } + pattern = /without identifiers is not allowed as a class variable name/ + assert_raise_with_message(SyntaxError, pattern) { eval('@@%') } + assert_raise_with_message(SyntaxError, pattern) { eval('@@') } end def test_invalid_char |