summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTakumasa Ochi <[email protected]>2023-08-14 21:56:44 +0900
committerHiroshi SHIBATA <[email protected]>2024-10-18 11:30:42 +0900
commit20dc1e5c255da87afb3829fa015142f23ee56b57 (patch)
tree1ebcf23c7c787650960986928a2d3de8cfbce7b8 /test
parent57e1b64c812210f7bd703bc5d8d459d7a1197629 (diff)
[ruby/json] Always dup argument to preserve original encoding for force_encoding
https://github.com/ruby/json/commit/db9a489ca2
Diffstat (limited to 'test')
-rw-r--r--test/json/json_parser_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb
index 610ea06f3f..d76281e6bc 100644
--- a/test/json/json_parser_test.rb
+++ b/test/json/json_parser_test.rb
@@ -26,6 +26,12 @@ class JSONParserTest < Test::Unit::TestCase
assert_equal Encoding::UTF_16, source.encoding
end if defined?(Encoding::UTF_16)
+ def test_argument_encoding_for_binary
+ source = "{}".encode("ASCII-8BIT")
+ JSON::Parser.new(source)
+ assert_equal Encoding::ASCII_8BIT, source.encoding
+ end if defined?(Encoding::ASCII_8BIT)
+
def test_error_message_encoding
pend if RUBY_ENGINE == 'truffleruby'