summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-13 17:58:36 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-13 17:59:03 +0530
commite26086fef3cf142cffd145836a4c7c12cfeb9656 (patch)
tree3db5cbe208ac30b9281599fa61dbe6c910fe4163 /tests
parent1a281a717fe5bab2694bf51c1b03a7569d8facb4 (diff)
downloadelxr-e26086fef3cf142cffd145836a4c7c12cfeb9656.tar.gz
elxr-e26086fef3cf142cffd145836a4c7c12cfeb9656.zip
refactor: propertymatch changed to use single expression (group)
Diffstat (limited to 'tests')
-rw-r--r--tests/eval.spec.ts19
-rw-r--r--tests/parser.spec.ts4
2 files changed, 9 insertions, 14 deletions
diff --git a/tests/eval.spec.ts b/tests/eval.spec.ts
index 2d7e1c0..f4999b6 100644
--- a/tests/eval.spec.ts
+++ b/tests/eval.spec.ts
@@ -26,18 +26,10 @@ describe('Eval', () => {
it('basic evaluation', () => {
const list = [0, 1, '2', 3, [4], 5]
- const liexp: ListExpr = [
- none,
- [Expr.AnyNumber(), Expr.Truthy()],
- none,
- ]
+ const liexp: ListExpr = [none, [Expr.AnyNumber(), Expr.Truthy()], none]
expect(find(liexp, list)).toEqual([1, 3, 5])
- const liexp2: ListExpr = [
- none,
- [Expr.Falsey(), Expr.Truthy()],
- none,
- ]
+ const liexp2: ListExpr = [none, [Expr.Falsey(), Expr.Truthy()], none]
expect(find(liexp2, list)).toEqual([])
})
@@ -69,9 +61,12 @@ describe('Eval', () => {
[
Expr.PropertyMatch({
name: 'name',
- exprs: [Expr.AnyString(), Expr.Truthy()],
+ expr: Expr.Group({ exprs: [Expr.AnyString(), Expr.Truthy()] }),
+ }),
+ Expr.PropertyMatch({
+ name: 'age',
+ expr: Expr.Group({ exprs: [Expr.AnyNumber()] }),
}),
- Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber()] }),
],
none,
]
diff --git a/tests/parser.spec.ts b/tests/parser.spec.ts
index c935165..bd71509 100644
--- a/tests/parser.spec.ts
+++ b/tests/parser.spec.ts
@@ -89,9 +89,9 @@ describe('Parser', () => {
wrap([
Expr.PropertyMatch({
name: 'name',
- exprs: [Expr.AnyString(), Expr.Truthy()],
+ expr: Expr.Group({ exprs: [Expr.AnyString(), Expr.Truthy()] }),
}),
- Expr.PropertyMatch({ name: 'age', exprs: [Expr.AnyNumber()] }),
+ Expr.PropertyMatch({ name: 'age', expr: Expr.Group({ exprs: [Expr.AnyNumber()] }) }),
]),
)
})