commit 0a97d003e92105b1700b93af3aaa3028a0f7f867
parent da816fe72dc3076db4245b6b96d39986ee4e39f5
Author: Sebastian <sebastian@sebsite.pw>
Date: Tue, 29 Aug 2023 02:20:12 -0400
hare::lex: test \x, \u, and \U in strings
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hare/lex/+test.ha b/hare/lex/+test.ha
@@ -243,7 +243,6 @@ fn loc(line: uint, col: uint) location = location {
const expected: [_]token = [
(ltok::LIT_STR, "ab\a\b\f\n\r\t\v\0\\\'", loc(1, 1)),
];
- // TODO: test \x and \u and \U
lextest(in, expected);
const in = `"ab\a\b\f\n\r\t\v\0\\\'"`;
const expected: [_]token = [
@@ -268,6 +267,11 @@ fn loc(line: uint, col: uint) location = location {
(ltok::LIT_STR, "foobaz", loc(1, 1)),
];
lextest(in, expected);
+ const in = `"\x7f" "\x1b" "\uabcd" "\U0010abcd"`;
+ const expected: [_]token = [
+ (ltok::LIT_STR, "\x7f\x1b\uabcd\U0010abcd", loc(1, 1)),
+ ];
+ lextest(in, expected);
};
@test fn literals() void = {