aboutsummaryrefslogtreecommitdiff
path: root/tests/eval.spec.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-10 21:29:42 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-10 21:29:42 +0530
commit3581e398a2fe2f38bee7e6d13cbf609221f61672 (patch)
tree95715115303ecb9620cbf37530e89a37c0ff5c4b /tests/eval.spec.ts
parentaa006086f69c827d780e6e0e69947ca7ee6e2c70 (diff)
downloadelxr-3581e398a2fe2f38bee7e6d13cbf609221f61672.tar.gz
elxr-3581e398a2fe2f38bee7e6d13cbf609221f61672.zip
feat: adds matchAll function (incomplete)
Diffstat (limited to '')
-rw-r--r--tests/eval.spec.ts24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/eval.spec.ts b/tests/eval.spec.ts
index 8c79375..ca06033 100644
--- a/tests/eval.spec.ts
+++ b/tests/eval.spec.ts
@@ -2,9 +2,27 @@ import { left, right } from 'fp-ts/Either'
import { none, some } from 'fp-ts/Option'
import { Expr, ListExpr } from '../src/types'
import { jlog } from '../src/utils'
-import { find } from '../src/eval'
+import { find, matchAll } from '../src/eval'
describe('Eval', () => {
+ it('should do stuff', () => {
+ const ls = [-1, 1, 2, '3', 4, '5', 6, 7, '']
+
+ const liexp: ListExpr = [
+ none,
+ [
+ Expr.OneOrMore({
+ expr: Expr.Group({
+ exprs: [Expr.AnyNumber(null), Expr.Truthy(null)],
+ }),
+ }),
+ ],
+ none,
+ ]
+
+ //jlog(matchAll(liexp, ls))
+ })
+
it('basic evaluation', () => {
const list = [0, 1, '2', 3, [4], 5]
@@ -66,9 +84,7 @@ describe('Eval', () => {
const liexp: ListExpr = [
none,
- [
- Expr.OneOrMore({ expr: Expr.AnyNumber(null) }),
- ],
+ [Expr.OneOrMore({ expr: Expr.AnyNumber(null) })],
none,
]
expect(find(liexp, list)).toEqual([1, 3, 5])