diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-06 06:53:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-06 06:53:22 +0000 |
commit | 24b37eb0a68bd18538d74aa421fa67d0fa5aa2b3 (patch) | |
tree | cd19caa0d6e8396d5ac9cfaa1d16a88e253c1674 /test/ruby | |
parent | ef617d50cd4940809735a4e1cab9599b6b7f7dd2 (diff) | |
download | ruby-24b37eb0a68bd18538d74aa421fa67d0fa5aa2b3.tar.gz |
load.c: fix load/require context
* load.c (rb_load_internal0): load/require is not the main
script.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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" |