aboutsummaryrefslogtreecommitdiff
path: root/src/eval-env/test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval-env/test.ts')
-rw-r--r--src/eval-env/test.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/eval-env/test.ts b/src/eval-env/test.ts
new file mode 100644
index 0000000..c394752
--- /dev/null
+++ b/src/eval-env/test.ts
@@ -0,0 +1,31 @@
+import { Type } from 'ts-morph'
+import { Ctx } from '../types'
+
+export const cleanup = () => {}
+
+export default (ctx: Ctx, args: Type[]) => ({
+ Test: async () => {
+ const [msg, effs] = args
+ process.stdout.write(` - ${ctx.getTypeValue(msg)}`)
+
+ try {
+ for (const eff of effs?.getTupleElements() ?? []) {
+ await ctx.evaluateType(ctx, eff)
+ }
+
+ console.log(' [✓]')
+ } catch(e) {
+ console.log(' [TEST FAILED]')
+ throw e
+ }
+ return []
+ },
+
+ Assert: async () => {
+ const [b] = args
+ if (!ctx.getTypeValue(b)) {
+ throw new Error('Assertion failed')
+ }
+ return []
+ },
+})