summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_rubyoptions.rb33
1 files changed, 20 insertions, 13 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 96ceb798b1f..b4203284cc3 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -808,18 +808,25 @@ class TestRubyOptions < Test::Unit::TestCase
def test_frozen_string_literal_debug
with_debug_pat = /created at/
wo_debug_pat = /can\'t modify frozen String \(RuntimeError\)\n\z/
-
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", "--debug-frozen-string-literal" ], '"foo" << "bar"', [], with_debug_pat)
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", "--debug=frozen-string-literal" ], '"foo" << "bar"', [], with_debug_pat)
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", ], '"foo" << "bar"', [], wo_debug_pat)
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", "--debug-frozen-string-literal" ], '"foo#{123}bar" << "bar"', [], with_debug_pat)
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", "--debug=frozen-string-literal" ], '"foo#{123}bar" << "bar"', [], with_debug_pat)
- assert_in_out_err(["--disable=gems", "--enable-frozen-string-literal", ], '"foo#{123}bar" << "bar"', [], wo_debug_pat)
- assert_in_out_err(["--disable=gems", "--disable-frozen-string-literal", "--debug-frozen-string-literal" ], '"foo" << "bar"', [], [])
- assert_in_out_err(["--disable=gems", "--disable-frozen-string-literal", "--debug=frozen-string-literal" ], '"foo" << "bar"', [], [])
- assert_in_out_err(["--disable=gems", "--disable-frozen-string-literal", ], '"foo" << "bar"', [], [])
- assert_in_out_err(["--disable=gems", "--debug-frozen-string-literal" ], '"foo" << "bar"', [], [])
- assert_in_out_err(["--disable=gems", "--debug=frozen-string-literal" ], '"foo" << "bar"', [], [])
- assert_in_out_err(["--disable=gems", ], '"foo" << "bar"', [], [])
+ frozen = [
+ ["--enable-frozen-string-literal", true],
+ ["--disable-frozen-string-literal", false],
+ [nil, false],
+ ]
+ debug = [
+ ["--debug-frozen-string-literal", true],
+ ["--debug=frozen-string-literal", true],
+ ["--debug", true],
+ [nil, false],
+ ]
+ opts = ["--disable=gems"]
+ frozen.product(debug) do |(opt1, freeze), (opt2, debug)|
+ opt = opts + [opt1, opt2].compact
+ err = !freeze ? [] : debug ? with_debug_pat : wo_debug_pat
+ assert_in_out_err(opt, '"foo" << "bar"', [], err)
+ if freeze
+ assert_in_out_err(opt, '"foo#{123}bar" << "bar"', [], err)
+ end
+ end
end
end