diff options
| author | Akshay Nair <phenax5@gmail.com> | 2022-01-08 21:12:20 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2022-01-08 21:12:20 +0530 |
| commit | e246f2341ee13926f4273c6d634cef4fe07f040e (patch) | |
| tree | 2dfcbdb24004b85c1a6ab2ed11c211621489c9a3 /tests/parser.spec.ts | |
| parent | 61bb1f0c8b109c66d48e678a4d2cf7cb29cf7efb (diff) | |
| download | elxr-e246f2341ee13926f4273c6d634cef4fe07f040e.tar.gz elxr-e246f2341ee13926f4273c6d634cef4fe07f040e.zip | |
feat(parse): implements object property matching parser
Diffstat (limited to 'tests/parser.spec.ts')
| -rw-r--r-- | tests/parser.spec.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts index 150966b..1ebd290 100644 --- a/tests/parser.spec.ts +++ b/tests/parser.spec.ts @@ -4,8 +4,10 @@ import { whitespace, whitespaces0, delimited, + many1, + satifyChar, } from '../src/parser/utils' -import { parser } from '../src/parser' +import { parser, propertyName } from '../src/parser' import { none, some } from 'fp-ts/Option' import { Expr } from '../src/types' @@ -82,4 +84,20 @@ describe('Foobar', () => { ]), ) }) + + it('object proprtyu', () => { + expect(parser(/ [name \s\T] [age \n] /.source)).toEqual( + right([ + [ + none, + [ + Expr.PropertyMatch({ name: 'name', exprs: [Expr.AnyString(null), Expr.Truthy(null)] }), + Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber(null)] }), + ], + none, + ], + '', + ]), + ) + }) }) |
