summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-27 09:27:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-27 09:27:57 +0000
commit1fd890ea43031e643aceac99f8e6fb4eeae55e8a (patch)
treede454166943c5132001c43627b53d129e3899949 /test/ruby/test_rubyoptions.rb
parent832c74f428db6c5bd6e575e1f6ea7fe0891c84d2 (diff)
test_rubyoptions.rb: test combinations
* test/ruby/test_rubyoptions.rb (test_frozen_string_literal): test combinations of command line option and pragma. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 927ad8ad8d..f446afc48e 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -785,17 +785,23 @@ class TestRubyOptions < Test::Unit::TestCase
end
def test_frozen_string_literal
- results = {}
- %W[frozen_string_literal frozen_string_literal].each do |arg|
+ all_assertions do |a|
[["disable", "false"], ["enable", "true"]].each do |opt, exp|
- key = "#{opt}=#{arg}"
- begin
- assert_in_out_err(["--disable=gems", "--#{key}"], 'p("foo".frozen?)', [exp])
- rescue MiniTest::Assertion => e
- results[key] = e
+ %W[frozen_string_literal frozen-string-literal].each do |arg|
+ key = "#{opt}=#{arg}"
+ a.for(key) do
+ assert_in_out_err(["--disable=gems", "--#{key}"], 'p("foo".frozen?)', [exp])
+ end
+ end
+ end
+ %W"disable enable".product(%W[false true]) do |opt, exp|
+ a.for("#{opt}=>#{exp}") do
+ assert_in_out_err(["-w", "--disable=gems", "--#{opt}=frozen-string-literal"], <<-"end;", [exp])
+ #-*- frozen-string-literal: #{exp} -*-
+ p("foo".frozen?)
+ end;
end
end
end
- assert_empty(results)
end
end