From 950faa740b86af5f264717898f24ae8fb65c036d Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 14 Jan 2022 21:15:29 +0530 Subject: feat: implements string literal parser --- tests/parser.spec.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/parser.spec.ts') diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts index 0506be0..6033040 100644 --- a/tests/parser.spec.ts +++ b/tests/parser.spec.ts @@ -6,7 +6,7 @@ import { delimited, not, symbol, - satifyChar, + satisfyChar, matchChar, manyTill, pair, @@ -146,6 +146,14 @@ describe('Parser', () => { expect(parser(/ false /.source)).toEqual( wrap(Expr.Literal(Literal.Boolean(false))), ) + + // String literal + expect(parser(/ "foobar" /.source)).toEqual( + wrap(Expr.Literal(Literal.String('foobar'))), + ) + expect(parser(/ "\nwowksadj\n\t wjksdlsd'' !@#%^(&^%$) " /.source)).toEqual( + wrap(Expr.Literal(Literal.String('\\nwowksadj\\n\\t wjksdlsd\'\' !@#%^(&^%$) '))), + ) }) it('sequence of values', () => { -- cgit v1.3.1