diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_require.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 818db4b6d3..5a7d118fc4 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -182,6 +182,26 @@ class TestRequire < Test::Unit::TestCase end end + def test_require_syntax_error + Dir.mktmpdir do |tmp| + req = File.join(tmp, "test.rb") + File.write(req, "'\n") + assert_raise_with_message(SyntaxError, /unterminated/) { + require req + } + end + end + + def test_load_syntax_error + Dir.mktmpdir do |tmp| + req = File.join(tmp, "test.rb") + File.write(req, "'\n") + assert_raise_with_message(SyntaxError, /unterminated/) { + load req + } + end + end + def test_define_class begin require "socket" |