[ruby/yarp] Fix errors on locals test caused by LANG=C

https://github.com/ruby/yarp/commit/8fae286bc9
This commit is contained in:
Kevin Newton 2023-08-16 21:12:44 -04:00 committed by git
parent 1c53e64c51
commit 48b241e53f

View File

@ -77,6 +77,15 @@ class LocalsTest < Test::Unit::TestCase
define_method("test_#{relative}") { assert_locals(filepath) }
end
def setup
@previous_default_external = Encoding.default_external
ignore_warnings { Encoding.default_external = Encoding::UTF_8 }
end
def teardown
ignore_warnings { Encoding.default_external = @previous_default_external }
end
private
def assert_locals(filepath)
@ -87,4 +96,12 @@ class LocalsTest < Test::Unit::TestCase
assert_equal(expected, actual)
end
def ignore_warnings
previous_verbosity = $VERBOSE
$VERBOSE = nil
yield
ensure
$VERBOSE = previous_verbosity
end
end