summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-12-09 20:53:02 -0800
committerJeremy Evans <code@jeremyevans.net>2020-12-10 10:16:05 -0800
commit01b7d5acc702df22d306ae95f1a9c3096e63e624 (patch)
treeec42028540f04653d1022a1ed83d509df77bd723 /test/ruby
parent4a559aa22537bbd2f17c7babb1aca48d1a3a4647 (diff)
Remove the uninitialized instance variable verbose mode warning
This speeds up all instance variable access, even when not in verbose mode. Uninitialized instance variable warnings were rarely helpful, and resulted in slower code if you wanted to avoid warnings when run in verbose mode. Implements [Feature #17055]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3879
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_exception.rb8
-rw-r--r--test/ruby/test_jit.rb2
-rw-r--r--test/ruby/test_module.rb4
3 files changed, 6 insertions, 8 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 536a02925c..087bcda5ac 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -955,8 +955,8 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
end
def test_warning_warn
- warning = capture_warning_warn {@a}
- assert_match(/instance variable @a not initialized/, warning[0])
+ warning = capture_warning_warn {$asdfasdsda_test_warning_warn}
+ assert_match(/global variable `\$asdfasdsda_test_warning_warn' not initialized/, warning[0])
assert_equal(["a\nz\n"], capture_warning_warn {warn "a\n", "z"})
assert_equal([], capture_warning_warn {warn})
@@ -1040,7 +1040,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
end
def test_warning_warn_super
- assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /instance variable @a not initialized/)
+ assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /global variable `\$asdfiasdofa_test_warning_warn_super' not initialized/)
{#
module Warning
def warn(message)
@@ -1049,7 +1049,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
end
$VERBOSE = true
- @a
+ $asdfiasdofa_test_warning_warn_super
};
end
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index bec6d30dfc..3a38b1a998 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -829,11 +829,9 @@ class TestJIT < Test::Unit::TestCase
end
end
- verbose, $VERBOSE = $VERBOSE, false # suppress "instance variable @b not initialized"
print(Foo.new.bar)
print(Foo.new.bar)
print(Foo.new.bar)
- $VERBOSE = verbose
end;
end
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index d63f31a56f..b676145ba7 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -2401,7 +2401,7 @@ class TestModule < Test::Unit::TestCase
def test_uninitialized_instance_variable
a = AttrTest.new
- assert_warning(/instance variable @ivar not initialized/) do
+ assert_warning('') do
assert_nil(a.ivar)
end
a.instance_variable_set(:@ivar, 42)
@@ -2410,7 +2410,7 @@ class TestModule < Test::Unit::TestCase
end
name = "@\u{5909 6570}"
- assert_warning(/instance variable #{name} not initialized/) do
+ assert_warning('') do
assert_nil(a.instance_eval(name))
end
end