1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Isolate the test for Encoding#replicate

It has global side effect which cannot be reverted.
This commit is contained in:
Nobuyoshi Nakada 2020-02-11 13:09:56 +09:00
parent 166c4a6a28
commit 921916ff9e
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -56,11 +56,13 @@ class TestEncoding < Test::Unit::TestCase
end
def test_replicate
assert_separately([], "#{<<~'END;'}")
assert_instance_of(Encoding, Encoding::UTF_8.replicate("UTF-8-ANOTHER#{Time.now.to_f}"))
assert_instance_of(Encoding, Encoding::ISO_2022_JP.replicate("ISO-2022-JP-ANOTHER#{Time.now.to_f}"))
bug3127 = '[ruby-dev:40954]'
assert_raise(TypeError, bug3127) {Encoding::UTF_8.replicate(0)}
assert_raise(ArgumentError, bug3127) {Encoding::UTF_8.replicate("\0")}
END;
end
def test_dummy_p