summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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