aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-14 21:15:29 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-14 21:15:29 +0530
commit950faa740b86af5f264717898f24ae8fb65c036d (patch)
tree86b3e226f8efa9b0004b31a0edf9b852716a59db /tests
parent3b0e7428441f85de5e76a59abbb09931bcf2387b (diff)
downloadelxr-950faa740b86af5f264717898f24ae8fb65c036d.tar.gz
elxr-950faa740b86af5f264717898f24ae8fb65c036d.zip
feat: implements string literal parser
Diffstat (limited to 'tests')
-rw-r--r--tests/parser.spec.ts10
1 files changed, 9 insertions, 1 deletions
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', () => {