Skip to content

Commit 21ab8bc

Browse files
committed
Partially failing crlf encoding roundtrip tests.
1 parent e111c14 commit 21ab8bc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

S15-nfg/crlf-encoding.t

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use v6;
2+
use Test;
3+
4+
plan 20;
5+
6+
for <utf-8 ascii latin-1 windows-1252> -> $encoding {
7+
my $buf = "\r\n".encode($encoding);
8+
is $buf.elems, 2, "CRLF encodes to 2 bytes ($encoding)";
9+
is $buf[0], 0x0D, "first byte is correct ($encoding)";
10+
is $buf[1], 0x0A, "second byte is correct ($encoding)";
11+
12+
my $str = $buf.decode($encoding);
13+
is $str.chars, 1, "decoding it gives back one grapheme ($encoding)";
14+
is $str, "\r\n", "decoding it gives back the correct grapheme ($encoding)";
15+
}

0 commit comments

Comments
 (0)