commit eebbd67e11ce79f6bfccfcf9ded7c73dd6721ec3
parent b1f546c2ced23f5004b6deabfeaf5b7d55c314bf
Author: Sebastian <sebastian@sebsite.pw>
Date: Fri, 13 May 2022 23:34:58 -0400
hare::lex: use raw strings in string tests
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hare/lex/+test.ha b/hare/lex/+test.ha
@@ -240,19 +240,18 @@ fn loc(line: uint, col: uint) location = location {
};
@test fn strings() void = {
- const in = "\"a\" \"b\" \"\\a\" \"\\b\" \"\\f\" \"\\n\" \"\\r\" "
- "\"\\t\" \"\\v\" \"\\0\" \"\\\\\" \"\\\'\"";
+ const in = `"a" "b" "\a" "\b" "\f" "\n" "\r" "\t" "\v" "\0" "\\" "\'"`;
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 in = `"ab\a\b\f\n\r\t\v\0\\\'"`;
const expected: [_]token = [
(ltok::LIT_STR, "ab\a\b\f\n\r\t\v\0\\\'", loc(1, 1)),
];
lextest(in, expected);
- const in = "\"hello world\", \"こんにちは\", \"return\", \"foo\"";
+ const in = `"hello world", "こんにちは", "return", "foo"`;
const expected: [_]token = [
(ltok::LIT_STR, "hello world", loc(1, 1)),
(ltok::COMMA, void, loc(1, 14)),