summaryrefslogtreecommitdiff
path: root/test/ruby/test_beginendblock.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_beginendblock.rb')
-rw-r--r--test/ruby/test_beginendblock.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index 909702a9e58..0543476875c 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -32,22 +32,19 @@ class TestBeginEndBlock < Test::Unit::TestCase
end
def test_begininmethod
- e = assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval("def foo; BEGIN {}; end")
end
- assert_match(/BEGIN is permitted only at toplevel/, e.message)
- e = assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval('eval("def foo; BEGIN {}; end")')
end
- assert_match(/BEGIN is permitted only at toplevel/, e.message)
end
def test_begininclass
- e = assert_raise(SyntaxError) do
+ assert_raise_with_message(SyntaxError, /BEGIN is permitted only at toplevel/) do
eval("class TestBeginEndBlock; BEGIN {}; end")
end
- assert_match(/BEGIN is permitted only at toplevel/, e.message)
end
def test_endblockwarn