summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-08-16 21:12:44 -0400
committergit <svn-admin@ruby-lang.org>2023-08-17 01:16:00 +0000
commit48b241e53fdb68c0ad115bcd23a43b310cc18db1 (patch)
tree2099d9446a713f177eaaa0df27c2e80150da20db
parent1c53e64c512668685bb7abaf1232518af3969496 (diff)
[ruby/yarp] Fix errors on locals test caused by LANG=C
https://github.com/ruby/yarp/commit/8fae286bc9
-rw-r--r--test/yarp/locals_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/yarp/locals_test.rb b/test/yarp/locals_test.rb
index d6b3120f62..4d9cea94a8 100644
--- a/test/yarp/locals_test.rb
+++ b/test/yarp/locals_test.rb
@@ -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