Skip to content

Commit b32a3f1

Browse files
committed
[Bug #18964] Add test for rb_econv_append
1 parent 485019c commit b32a3f1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/-ext-/econv/test_append.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: false
2+
require 'test/unit'
3+
require "-test-/econv"
4+
5+
class Test_EConvAppend < Test::Unit::TestCase
6+
def test_econv_str_append_valid
7+
ec = Bug::EConv.new("utf-8", "cp932")
8+
dst = "\u3044".encode("cp932")
9+
ret = ec.append("\u3042"*30, dst)
10+
assert_same(dst, ret)
11+
assert_not_predicate(dst, :ascii_only?)
12+
assert_predicate(dst, :valid_encoding?)
13+
end
14+
15+
def test_econv_str_append_broken
16+
ec = Bug::EConv.new("utf-8", "cp932")
17+
dst = ""
18+
ret = ec.append("\u3042"*30, dst)
19+
assert_same(dst, ret)
20+
assert_not_predicate(dst, :ascii_only?)
21+
assert_not_predicate(dst, :valid_encoding?)
22+
end
23+
end

0 commit comments

Comments
 (0)