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:
parent
832c74f428
commit
1fd890ea43
1 changed files with 14 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue