Skip to content

Commit 6281806

Browse files
committed
Change TestString#test_ascii_incomat_inspect to use EnvUtil.with_default_external
1 parent 89321c6 commit 6281806

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

test/ruby/test_string.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,18 +3251,12 @@ def test_ascii_incomat_inspect
32513251
assert_equal('"\\u3042\\u3044\\u3046"', S("\u3042\u3044\u3046".encode(e)).inspect)
32523252
assert_equal('"ab\\"c"', S("ab\"c".encode(e)).inspect, bug4081)
32533253
end
3254-
begin
3255-
verbose, $VERBOSE = $VERBOSE, nil
3256-
ext = Encoding.default_external
3257-
Encoding.default_external = "us-ascii"
3258-
$VERBOSE = verbose
3254+
3255+
EnvUtil.with_default_external(Encoding::US_ASCII) do
32593256
i = S("abc\"\\".force_encoding("utf-8")).inspect
3260-
ensure
3261-
$VERBOSE = nil
3262-
Encoding.default_external = ext
3263-
$VERBOSE = verbose
3257+
3258+
assert_equal('"abc\\"\\\\"', i, bug4081)
32643259
end
3265-
assert_equal('"abc\\"\\\\"', i, bug4081)
32663260
end
32673261

32683262
def test_dummy_inspect

0 commit comments

Comments
 (0)