From d362ef26db894ea52c6abd34489aa9efdbc0c89b Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Jan 2023 13:22:39 +0530 Subject: chore: adds test cases + fixes Test effect scope --- src/eval-env/test.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/eval-env/test.ts') diff --git a/src/eval-env/test.ts b/src/eval-env/test.ts index 84ae138..4dd8c8d 100644 --- a/src/eval-env/test.ts +++ b/src/eval-env/test.ts @@ -2,7 +2,7 @@ import { Type } from 'ts-morph' import { Ctx } from '../types' export default (ctx: Ctx, args: Type[]) => ({ - Test: async () => { + Test: ctx.withScope(async () => { const [msg, effs] = args process.stdout.write(` - ${ctx.getTypeValue(msg)} `) @@ -13,12 +13,12 @@ export default (ctx: Ctx, args: Type[]) => ({ console.log('[✓]') } catch (e) { - console.log('[TEST FAILED]') + // console.log('[TEST FAILED]') throw e } return [] - }, + }), Assert: async () => { if (!ctx.getTypeValue(args[0])) { @@ -27,4 +27,15 @@ export default (ctx: Ctx, args: Type[]) => ({ return [] }, + + ShowAssertionError: async () => { + const [left, right] = args + console.log() + console.log(' | Assertion error:') + console.log(' | - Left: ', ctx.typeToString(left)) + console.log(' | - Right:', ctx.typeToString(right)) + console.log() + + return [] + }, }) -- cgit v1.3.1