summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-28 07:22:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-28 07:22:43 +0000
commit4079a35447218918a2494b5d7242c9a80b540183 (patch)
treea5b9f053fb5b66c3316cfe3615896660db6adf67 /test
parentc98b8d622b0d008dc881f92b1f71aebac009fcf2 (diff)
ruby.c: no -r when dump
* ruby.c (process_options, load_file_internal2): should not require other files when dump option is given. [ruby-dev:48712] [Bug #10435] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_rubyoptions.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index d4e5b2ac9c..ac7cc7b210 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -710,4 +710,41 @@ class TestRubyOptions < Test::Unit::TestCase
bug7157 = '[ruby-core:47967]'
assert_in_out_err(['-p', '-e', 'sub(/t.*/){"TEST"}'], %[test], %w[TEST], [], bug7157)
end
+
+ def assert_norun_with_rflag(opt)
+ bug10435 = "[ruby-dev:48712] [Bug #10435]: should not run with #{opt} option"
+ stderr = []
+ Tempfile.create(%w"bug10435- .rb") do |script|
+ dir, base = File.split(script.path)
+ script.puts "abort ':run'"
+ script.close
+ opts = ['-C', dir, '-r', "./#{base}", opt]
+ assert_in_out_err([*opts, '-ep']) do |_, e|
+ stderr.concat(e)
+ end
+ stderr << "---"
+ assert_in_out_err([*opts, base]) do |_, e|
+ stderr.concat(e)
+ end
+ end
+ assert_not_include(stderr, ":run", bug10435)
+ end
+
+ def test_dump_syntax_with_rflag
+ assert_norun_with_rflag('-c')
+ assert_norun_with_rflag('--dump=syntax')
+ end
+
+ def test_dump_yydebug_with_rflag
+ assert_norun_with_rflag('-y')
+ assert_norun_with_rflag('--dump=yydebug')
+ end
+
+ def test_dump_parsetree_with_rflag
+ assert_norun_with_rflag('--dump=parsetree')
+ end
+
+ def test_dump_insns_with_rflag
+ assert_norun_with_rflag('--dump=insns')
+ end
end