From a0b2b749e80991f50abd14659fea15cb35725ba3 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 27 Sep 2015 09:27:57 +0000 Subject: 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 --- test/ruby/test_rubyoptions.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'test/ruby/test_rubyoptions.rb') 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 -- cgit v1.2.3