Skip to content

Commit

Permalink
Isolate the test for Encoding#replicate
Browse files Browse the repository at this point in the history
It has global side effect which cannot be reverted.
  • Loading branch information
nobu committed Feb 12, 2020
1 parent 166c4a6 commit 921916f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/ruby/test_encoding.rb
Expand Up @@ -56,11 +56,13 @@ def test_find
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
Expand Down

0 comments on commit 921916f

Please sign in to comment.