aboutsummaryrefslogtreecommitdiff
path: root/src/eval-env/test.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-14 13:22:39 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-14 13:22:39 +0530
commitd362ef26db894ea52c6abd34489aa9efdbc0c89b (patch)
tree20400ad5ebc70085447e2bb087381aa8c8409afd /src/eval-env/test.ts
parent4746652abfb7aed46627d27a55919d2986885735 (diff)
downloadts-types-lang-d362ef26db894ea52c6abd34489aa9efdbc0c89b.tar.gz
ts-types-lang-d362ef26db894ea52c6abd34489aa9efdbc0c89b.zip
chore: adds test cases + fixes Test effect scope
Diffstat (limited to 'src/eval-env/test.ts')
-rw-r--r--src/eval-env/test.ts17
1 files changed, 14 insertions, 3 deletions
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 []
+ },
})