summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2024-09-15 09:50:14 +0900
committerYusuke Endoh <[email protected]>2024-09-17 12:44:07 +0900
commit76d927f88f9b64cf01912be41d5e88238a9e6ec6 (patch)
treecdbf9845add78f78d24116c2da93538788aa4a9d
parente08d5239b68ad61a731f4938cf963e37a5e88c25 (diff)
Prevent prism warnings in syntax exhaustive tests
[Bug #20736]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11626
-rw-r--r--test/ruby/test_literal.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index 9b294bc8ea..1fdc6aa853 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -39,6 +39,8 @@ class TestRubyLiteral < Test::Unit::TestCase
end
def test_string
+ verbose_bak, $VERBOSE = $VERBOSE, nil # prevent syntax warnings
+
assert_instance_of String, ?a
assert_equal "a", ?a
assert_instance_of String, ?A
@@ -94,6 +96,9 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_equal "ab", eval("?a 'b'")
assert_equal "a\nb", eval("<<A 'b'\na\nA")
+
+ ensure
+ $VERBOSE = verbose_bak
end
def test_dstring
@@ -591,6 +596,8 @@ class TestRubyLiteral < Test::Unit::TestCase
end
def test_integer
+ verbose_bak, $VERBOSE = $VERBOSE, nil # prevent syntax warnings
+
head = ['', '0x', '0o', '0b', '0d', '-', '+']
chars = ['0', '1', '_', '9', 'f']
head.each {|h|
@@ -620,9 +627,14 @@ class TestRubyLiteral < Test::Unit::TestCase
assert_syntax_error(h, /numeric literal without digits\Z/, "#{bug2407}: #{h.inspect}")
end
end
+
+ ensure
+ $VERBOSE = verbose_bak
end
def test_float
+ verbose_bak, $VERBOSE = $VERBOSE, nil # prevent syntax warnings
+
head = ['', '-', '+']
chars = ['0', '1', '_', '9', 'f', '.']
head.each {|h|
@@ -659,6 +671,9 @@ class TestRubyLiteral < Test::Unit::TestCase
}
}
assert_equal(100.0, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100)
+
+ ensure
+ $VERBOSE = verbose_bak
end
def test_symbol_list