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

ruby-changes:73966

From: Yusuke <ko1@a...>
Date: Wed, 12 Oct 2022 21:49:59 +0900 (JST)
Subject: [ruby-changes:73966] 9cfc45d6e5 (master): Suppress warnings in test/ruby/test_ast.rb

https://git.ruby-lang.org/ruby.git/commit/?id=9cfc45d6e5

From 9cfc45d6e52cf4ffde0375f8d3f2271c36e9e91c Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 12 Oct 2022 21:48:28 +0900
Subject: Suppress warnings in test/ruby/test_ast.rb

The tests for error tolerance printed some warnings. This change
suppresses them.
---
 test/ruby/test_ast.rb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index b91880be6d..aaf626e801 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -568,6 +568,7 @@ dummy https://github.com/ruby/ruby/blob/trunk/test/ruby/test_ast.rb#L568
   end
 
   def test_error_tolerant
+    verbose_bak, $VERBOSE = $VERBOSE, false
     node = RubyVM::AbstractSyntaxTree.parse(<<~STR, error_tolerant: true)
       class A
         def m
@@ -579,6 +580,8 @@ dummy https://github.com/ruby/ruby/blob/trunk/test/ruby/test_ast.rb#L580
     assert_nil($!)
 
     assert_equal(:SCOPE, node.type)
+  ensure
+    $VERBOSE = verbose_bak
   end
 
   def test_error_tolerant_end_is_short_for_method_define
@@ -965,7 +968,12 @@ dummy https://github.com/ruby/ruby/blob/trunk/test/ruby/test_ast.rb#L968
   end
 
   def assert_error_tolerant(src, expected)
-    node = RubyVM::AbstractSyntaxTree.parse(src, error_tolerant: true)
+    begin
+      verbose_bak, $VERBOSE = $VERBOSE, false
+      node = RubyVM::AbstractSyntaxTree.parse(src, error_tolerant: true)
+    ensure
+      $VERBOSE = verbose_bak
+    end
     assert_nil($!)
     str = ""
     PP.pp(node, str, 80)
-- 
cgit v1.2.1


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

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