From 42f8c401dc9519bc8b2d386ce9eda072144a46d0 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 13 Jan 2023 19:40:15 +0530 Subject: feat: refactors test runner --- src/eval-env/test.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/eval-env/test.ts') diff --git a/src/eval-env/test.ts b/src/eval-env/test.ts index c394752..eddf366 100644 --- a/src/eval-env/test.ts +++ b/src/eval-env/test.ts @@ -1,31 +1,30 @@ 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)}`) + process.stdout.write(` - ${ctx.getTypeValue(msg)} `) try { for (const eff of effs?.getTupleElements() ?? []) { await ctx.evaluateType(ctx, eff) } - console.log(' [✓]') + console.log('[✓]') } catch(e) { - console.log(' [TEST FAILED]') + console.log('[TEST FAILED]') throw e } + return [] }, Assert: async () => { - const [b] = args - if (!ctx.getTypeValue(b)) { + if (!ctx.getTypeValue(args[0])) { throw new Error('Assertion failed') } + return [] }, }) -- cgit v1.3.1