Skip to content

Commit 15c7c90

Browse files
committed
Refine rb_enc_strlen specs
1 parent 7f05e9d commit 15c7c90

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spec/ruby/optional/capi/encoding_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@
7575

7676
it "returns the string length based on a fixed-width encoding's character length, even if the encoding is incompatible" do
7777
@s.rb_enc_strlen(@str, @str.bytesize, Encoding::UTF_16BE).should == 6
78+
@s.rb_enc_strlen(@str, @str.bytesize, Encoding::UTF_16LE).should == 6
7879
@s.rb_enc_strlen(@str, @str.bytesize, Encoding::UTF_32BE).should == 3
80+
@s.rb_enc_strlen(@str, @str.bytesize, Encoding::UTF_32LE).should == 3
7981
end
8082

8183
it "does not consider strings to be NUL-terminated" do
@@ -91,9 +93,13 @@
9193
@s.rb_enc_strlen(@str, 5, Encoding::UTF_8).should == 3
9294
end
9395

94-
it "rounds up for fixed-width encodings" do
96+
it "combines valid character and invalid character counts in UTF-16" do
9597
@s.rb_enc_strlen(@str, 5, Encoding::UTF_16BE).should == 3
98+
end
99+
100+
it "rounds up for fixed-width encodings" do
96101
@s.rb_enc_strlen(@str, 5, Encoding::UTF_32BE).should == 2
102+
@s.rb_enc_strlen(@str, 5, Encoding::UTF_32LE).should == 2
97103
@s.rb_enc_strlen(@str, 5, Encoding::BINARY).should == 5
98104
end
99105
end

0 commit comments

Comments
 (0)