From 177856b8a73269366508194066e119305548535e Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Oct 2017 11:24:19 +0000 Subject: [PATCH] Test for r60396 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_rubyoptions.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 27969690d8..8cb74edb32 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -346,6 +346,21 @@ class TestRubyOptions < Test::Unit::TestCase assert_ruby_status(%w[], "#! ruby -- /", '[ruby-core:82267] [Bug #13786]') end + def test_flag_in_shebang + Tempfile.create(%w"pflag .rb") do |script| + code = "#!ruby -p" + script.puts(code) + script.close + assert_in_out_err([script.path, script.path], '', [code]) + end + Tempfile.create(%w"sflag .rb") do |script| + script.puts("#!ruby -s") + script.puts("p $abc") + script.close + assert_in_out_err([script.path, "-abc=foo"], '', ['"foo"']) + end + end + def test_sflag assert_in_out_err(%w(- -abc -def=foo -ghi-jkl -- -xyz), "#!ruby -s\np [$abc, $def, $ghi_jkl, defined?($xyz)]\n",