[前][次][番号順一覧][スレッド一覧]

ruby-changes:40932

From: nobu <ko1@a...>
Date: Thu, 10 Dec 2015 02:48:49 +0900 (JST)
Subject: [ruby-changes:40932] nobu:r53011 (trunk): test_rubyoptions.rb: test --debug

nobu	2015-12-10 02:48:26 +0900 (Thu, 10 Dec 2015)

  New Revision: 53011

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53011

  Log:
    test_rubyoptions.rb: test --debug
    
    * test/ruby/test_rubyoptions.rb (test_frozen_string_literal_debug):
      test --debug option too.

  Modified files:
    trunk/test/ruby/test_rubyoptions.rb
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 53010)
+++ test/ruby/test_rubyoptions.rb	(revision 53011)
@@ -808,18 +808,25 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L808
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]