Skip to content
Browse files

add a test to ensure utf8 codepoints come out right

not, for example, negative or off-by-one.
  • Loading branch information...
1 parent ef215fd commit 2b3c0d429ecc55ac68672479ba30f3d43cd45522 @timo timo committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 S32-str/encode.t
View
3 S32-str/encode.t
@@ -20,6 +20,9 @@ is_deeply 'abc'.encode()[1, 2], (98, 99), 'can slice-index a Buf';
ok ('ä'.encode('UTF-8', 'D') eqv Buf.new(:16<61>, :16<cc>, :16<88>)),
'encoding to UTF-8, with NFD';
+ok ('ä'.encode('UTF-8') eqv Buf.new(:16<c3>, :16<a4>)),
+ 'encoding ä utf8 gives correct numbers';
+
ok Buf.new(195, 182).decode ~~ Str, '.decode returns a Str';
is Buf.new(195, 182).decode, 'ö', 'decoding a Buf with UTF-8';
is Buf.new(246).decode('ISO-8859-1'), 'ö', 'decoding a Buf with Latin-1';

0 comments on commit 2b3c0d4

Please sign in to comment.
Something went wrong with that request. Please try again.