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

ruby-changes:34308

From: nobu <ko1@a...>
Date: Tue, 10 Jun 2014 10:45:07 +0900 (JST)
Subject: [ruby-changes:34308] nobu:r46389 (trunk): envutil.rb: use keyword argument

nobu	2014-06-10 10:44:57 +0900 (Tue, 10 Jun 2014)

  New Revision: 46389

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

  Log:
    envutil.rb: use keyword argument
    
    * test/ruby/envutil.rb (assert_valid_syntax): use keyword argument.

  Modified files:
    trunk/test/ruby/envutil.rb
    trunk/test/ruby/test_syntax.rb
Index: test/ruby/test_syntax.rb
===================================================================
--- test/ruby/test_syntax.rb	(revision 46388)
+++ test/ruby/test_syntax.rb	(revision 46389)
@@ -143,14 +143,14 @@ class TestSyntax < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L143
   def test_warn_grouped_expression
     bug5214 = '[ruby-core:39050]'
     assert_warning("", bug5214) do
-      assert_valid_syntax("foo \\\n(\n  true)", "test") {$VERBOSE = true}
+      assert_valid_syntax("foo \\\n(\n  true)", "test", verbose: true)
     end
   end
 
   def test_warn_unreachable
     assert_warning("test:3: warning: statement not reached\n") do
       code = "loop do\n" "break\n" "foo\n" "end"
-      assert_valid_syntax(code, "test") {$VERBOSE = true}
+      assert_valid_syntax(code, "test", verbose: true)
     end
   end
 
@@ -170,7 +170,7 @@ WARN https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L170
      [:%, "string literal"],
     ].each do |op, syn|
       assert_warning(warning % [op, syn]) do
-        assert_valid_syntax("puts 1 #{op}0", "test") {$VERBOSE = true}
+        assert_valid_syntax("puts 1 #{op}0", "test", verbose: true)
       end
     end
   end
Index: test/ruby/envutil.rb
===================================================================
--- test/ruby/envutil.rb	(revision 46388)
+++ test/ruby/envutil.rb	(revision 46389)
@@ -219,13 +219,13 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L219
   module Unit
     module Assertions
       public
-      def assert_valid_syntax(code, fname = caller_locations(1, 1)[0], mesg = fname.to_s)
+      def assert_valid_syntax(code, fname = caller_locations(1, 1)[0], mesg = fname.to_s, verbose: nil)
         code = code.dup.force_encoding("ascii-8bit")
         code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
           "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n"
         }
         code.force_encoding(Encoding::UTF_8)
-        verbose, $VERBOSE = $VERBOSE, nil
+        verbose, $VERBOSE = $VERBOSE, verbose
         yield if defined?(yield)
         case
         when Array === fname

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

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