ruby-changes:39874
From: nobu <ko1@a...>
Date: Sun, 27 Sep 2015 18:28:20 +0900 (JST)
Subject: [ruby-changes:39874] nobu:r51955 (trunk): test_rubyoptions.rb: test combinations
nobu 2015-09-27 18:27:57 +0900 (Sun, 27 Sep 2015) New Revision: 51955 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51955 Log: test_rubyoptions.rb: test combinations * test/ruby/test_rubyoptions.rb (test_frozen_string_literal): test combinations of command line option and pragma. Modified files: trunk/test/ruby/test_rubyoptions.rb Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 51954) +++ test/ruby/test_rubyoptions.rb (revision 51955) @@ -785,17 +785,23 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L785 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/