diff options
| author | Akshay Nair <phenax5@gmail.com> | 2022-01-13 14:49:05 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2022-01-13 14:49:05 +0530 |
| commit | 6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93 (patch) | |
| tree | b884da940ff47683064e1723655ed46b8ab7f85d /tests | |
| parent | 6362218062a7b41e4aefe902ba5aed11aaa540c5 (diff) | |
| download | elxr-6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93.tar.gz elxr-6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93.zip | |
refactor: type + constructors refactor
Diffstat (limited to '')
| -rw-r--r-- | tests/eval.spec.ts | 16 | ||||
| -rw-r--r-- | tests/parser.spec.ts | 36 |
2 files changed, 26 insertions, 26 deletions
diff --git a/tests/eval.spec.ts b/tests/eval.spec.ts index ca06033..2d7e1c0 100644 --- a/tests/eval.spec.ts +++ b/tests/eval.spec.ts @@ -13,7 +13,7 @@ describe('Eval', () => { [ Expr.OneOrMore({ expr: Expr.Group({ - exprs: [Expr.AnyNumber(null), Expr.Truthy(null)], + exprs: [Expr.AnyNumber(), Expr.Truthy()], }), }), ], @@ -28,14 +28,14 @@ describe('Eval', () => { const liexp: ListExpr = [ none, - [Expr.AnyNumber(null), Expr.Truthy(null)], + [Expr.AnyNumber(), Expr.Truthy()], none, ] expect(find(liexp, list)).toEqual([1, 3, 5]) const liexp2: ListExpr = [ none, - [Expr.Falsey(null), Expr.Truthy(null)], + [Expr.Falsey(), Expr.Truthy()], none, ] expect(find(liexp2, list)).toEqual([]) @@ -47,8 +47,8 @@ describe('Eval', () => { const liexp: ListExpr = [ none, [ - Expr.AnyItem(null), - Expr.Group({ exprs: [Expr.AnyNumber(null), Expr.Truthy(null)] }), + Expr.AnyItem(), + Expr.Group({ exprs: [Expr.AnyNumber(), Expr.Truthy()] }), ], none, ] @@ -69,9 +69,9 @@ describe('Eval', () => { [ Expr.PropertyMatch({ name: 'name', - exprs: [Expr.AnyString(null), Expr.Truthy(null)], + exprs: [Expr.AnyString(), Expr.Truthy()], }), - Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber(null)] }), + Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber()] }), ], none, ] @@ -84,7 +84,7 @@ describe('Eval', () => { const liexp: ListExpr = [ none, - [Expr.OneOrMore({ expr: Expr.AnyNumber(null) })], + [Expr.OneOrMore({ expr: Expr.AnyNumber() })], none, ] expect(find(liexp, list)).toEqual([1, 3, 5]) diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts index 4db0894..9bc891e 100644 --- a/tests/parser.spec.ts +++ b/tests/parser.spec.ts @@ -33,15 +33,15 @@ describe('Foobar', () => { expect(parser(/^ .\s(\n)\b \T $/.source)).toEqual( right([ [ - some(Expr.Start(null)), + some(Expr.Start()), [ - Expr.AnyItem(null), - Expr.AnyString(null), - Expr.Group({ exprs: [Expr.AnyNumber(null)] }), - Expr.AnyBool(null), - Expr.Truthy(null), + Expr.AnyItem(), + Expr.AnyString(), + Expr.Group({ exprs: [Expr.AnyNumber()] }), + Expr.AnyBool(), + Expr.Truthy(), ], - some(Expr.End(null)), + some(Expr.End()), ], '', ]), @@ -50,13 +50,13 @@ describe('Foobar', () => { expect(parser(/^ \s* \T? \n+ $/.source)).toEqual( right([ [ - some(Expr.Start(null)), + some(Expr.Start()), [ - Expr.ZeroOrMore({ expr: Expr.AnyString(null) }), - Expr.Optional({ expr: Expr.Truthy(null) }), - Expr.OneOrMore({ expr: Expr.AnyNumber(null) }), + Expr.ZeroOrMore({ expr: Expr.AnyString() }), + Expr.Optional({ expr: Expr.Truthy() }), + Expr.OneOrMore({ expr: Expr.AnyNumber() }), ], - some(Expr.End(null)), + some(Expr.End()), ], '', ]), @@ -68,12 +68,12 @@ describe('Foobar', () => { none, [ Expr.Or({ - left: Expr.AnyString(null), + left: Expr.AnyString(), right: [ - Expr.AnyBool(null), + Expr.AnyBool(), Expr.Or({ - left: Expr.Truthy(null), - right: [Expr.AnyNumber(null)], + left: Expr.Truthy(), + right: [Expr.AnyNumber()], }), ], }), @@ -93,9 +93,9 @@ describe('Foobar', () => { [ Expr.PropertyMatch({ name: 'name', - exprs: [Expr.AnyString(null), Expr.Truthy(null)], + exprs: [Expr.AnyString(), Expr.Truthy()], }), - Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber(null)] }), + Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber()] }), ], none, ], |
