Skip to content

Commit

Permalink
* test/ruby/envutil.rb (default_warning): New method.
Browse files Browse the repository at this point in the history
* test/ruby/test_autoload.rb: Use EnvUtil.default_warning.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Jun 1, 2014
1 parent 0468310 commit fe38158
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Mon Jun 2 07:30:33 2014 Tanaka Akira <[email protected]>

* test/ruby/envutil.rb (default_warning): New method.

* test/ruby/test_autoload.rb: Use EnvUtil.default_warning.

Mon Jun 2 07:05:59 2014 Nobuyoshi Nakada <[email protected]>

* include/ruby/encoding.h: constify `rb_encoding` arguments.
Expand Down
8 changes: 8 additions & 0 deletions test/ruby/envutil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ class << (stderr = "")
end
module_function :verbose_warning

def default_warning
verbose, $VERBOSE = $VERBOSE, false
yield
ensure
$VERBOSE = verbose
end
module_function :default_warning

def suppress_warning
verbose, $VERBOSE = $VERBOSE, nil
yield
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_autoload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_require_explicit

def test_threaded_accessing_constant
# Suppress "warning: loading in progress, circular require considered harmful"
EnvUtil.suppress_warning {
EnvUtil.default_warning {
Tempfile.create(['autoload', '.rb']) {|file|
file.puts 'sleep 0.5; class AutoloadTest; X = 1; end'
file.close
Expand All @@ -94,7 +94,7 @@ def test_threaded_accessing_constant

def test_threaded_accessing_inner_constant
# Suppress "warning: loading in progress, circular require considered harmful"
EnvUtil.suppress_warning {
EnvUtil.default_warning {
Tempfile.create(['autoload', '.rb']) {|file|
file.puts 'class AutoloadTest; sleep 0.5; X = 1; end'
file.close
Expand Down

0 comments on commit fe38158

Please sign in to comment.