Skip to content

Commit 7656aa3

Browse files
committed
fixup! fix: properly parse octal escape sequences
1 parent 9ebd42d commit 7656aa3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/parse/parse.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,16 @@ R(["pyret-base/js/pyret-tokenizer", "pyret-base/js/pyret-parser", "fs"], functio
764764
});
765765

766766
it("should parse octal escape squences", function() {
767-
expect(parse("\\0")).toBe("");
768-
expect(parse("\\101")).toBe("A");
769-
expect(parse("\\101bc")).toBe("Abc");
770-
expect(parse("\\77")).toBe("?");
771-
expect(parse("\\88")).toBe("88");
767+
expect(parse("a = '\\0'").toString()).toContain(stringAst('\\u0000'));
768+
expect(parse("a = '\\101'").toString()).toContain(stringAst('A'));
769+
expect(parse("a = '\\101bc'").toString()).toContain(stringAst('Abc'));
770+
expect(parse("a = '\\77'").toString()).toContain(stringAst('?'));
771+
772+
expect(parse("a = '\\88'")).toBe(false);
773+
774+
function stringAst(str) {
775+
return `'STRING "'${str}'"`;
776+
}
772777
});
773778
});
774779

0 commit comments

Comments
 (0)