summaryrefslogtreecommitdiff
path: root/test/-ext-/string/test_enc_str_buf_cat.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-26 16:05:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-26 16:05:15 +0900
commit391abc543cea118a9cd7d6310acadbfa352668ef (patch)
treeffa95b0a708ab6d4fd4237d324e474396dd2653e /test/-ext-/string/test_enc_str_buf_cat.rb
parent457a4913be7de70f43a40cdec20e9cbfaacfda36 (diff)
Scan the coderange in the given encoding
Diffstat (limited to 'test/-ext-/string/test_enc_str_buf_cat.rb')
-rw-r--r--test/-ext-/string/test_enc_str_buf_cat.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/-ext-/string/test_enc_str_buf_cat.rb b/test/-ext-/string/test_enc_str_buf_cat.rb
index 72f903903c7..b9a63ec2dea 100644
--- a/test/-ext-/string/test_enc_str_buf_cat.rb
+++ b/test/-ext-/string/test_enc_str_buf_cat.rb
@@ -13,4 +13,13 @@ class Test_StringEncStrBufCat < Test::Unit::TestCase
assert_equal(:unknown, Bug::String.new(cr_unknown_str).coderange, "an assertion for following tests")
assert_equal(:valid, Bug::String.new(a8_str).enc_str_buf_cat(cr_unknown_str).coderange, Bug6509)
end
+
+ def test_str_conv_enc
+ str = Bug::String.new("aaa".encode("US-ASCII"))
+ assert_same(str, str.str_conv_enc_opts("UTF-8", "US-ASCII", 0, nil))
+
+ str = Bug::String.new("aaa".encode("UTF-16LE").force_encoding("UTF-8"))
+ assert_predicate(str, :ascii_only?) # cache coderange
+ assert_equal("aaa", str.str_conv_enc_opts("UTF-16LE", "UTF-8", 0, nil))
+ end
end