1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-09-27 09:27:57 +00:00
parent 832c74f428
commit 1fd890ea43

View file

@ -785,17 +785,23 @@ class TestRubyOptions < Test::Unit::TestCase
end end
def test_frozen_string_literal def test_frozen_string_literal
results = {} all_assertions do |a|
%W[frozen_string_literal frozen_string_literal].each do |arg|
[["disable", "false"], ["enable", "true"]].each do |opt, exp| [["disable", "false"], ["enable", "true"]].each do |opt, exp|
key = "#{opt}=#{arg}" %W[frozen_string_literal frozen-string-literal].each do |arg|
begin key = "#{opt}=#{arg}"
assert_in_out_err(["--disable=gems", "--#{key}"], 'p("foo".frozen?)', [exp]) a.for(key) do
rescue MiniTest::Assertion => e assert_in_out_err(["--disable=gems", "--#{key}"], 'p("foo".frozen?)', [exp])
results[key] = e 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 end
end end
assert_empty(results)
end end
end end