summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-08 18:37:57 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-08 18:37:57 +0530
commitd19a1e4e02c6743f057d03caa9337a5b47bfa9cd (patch)
tree44f4f27436d8fbc64a65e16bb122ae3775e22baf /tests
parente8322ca988fc20baf7892915e6ccb069b11c608e (diff)
downloadelxr-d19a1e4e02c6743f057d03caa9337a5b47bfa9cd.tar.gz
elxr-d19a1e4e02c6743f057d03caa9337a5b47bfa9cd.zip
feat(eval): implements basic eval filtering
Diffstat (limited to 'tests')
-rw-r--r--tests/eval.spec.ts20
-rw-r--r--tests/parser.spec.ts (renamed from tests/basic.spec.ts)0
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/eval.spec.ts b/tests/eval.spec.ts
new file mode 100644
index 0000000..97995bf
--- /dev/null
+++ b/tests/eval.spec.ts
@@ -0,0 +1,20 @@
+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'
+
+describe('Eval', () => {
+ it('should do shit', () => {
+ const liexp: ListExpr = [
+ none,
+ [ Expr.AnyNumber(null), Expr.Truthy(null) ],
+ none,
+ ]
+
+ const list = [0, 1, '2', 3, [4], 5]
+
+ expect(find(liexp, list)).toEqual([1, 3, 5])
+ })
+})
+
diff --git a/tests/basic.spec.ts b/tests/parser.spec.ts
index 150966b..150966b 100644
--- a/tests/basic.spec.ts
+++ b/tests/parser.spec.ts