From cd11925707c42843df195d9b2efb3c77b5de793b Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Jan 2023 17:12:48 +0530 Subject: feat: adds cleanup of result nodes --- tests/builtins.spec.ts | 138 ++++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'tests') diff --git a/tests/builtins.spec.ts b/tests/builtins.spec.ts index cd4b5c4..cbac0d3 100644 --- a/tests/builtins.spec.ts +++ b/tests/builtins.spec.ts @@ -4,93 +4,93 @@ import { PutStringLn } from '../stdlib/stdio' import { DefineEffect, JsExpr, SetEvalEnvironment } from '../stdlib/sys' import { Test, AssertEqualsK, AssertEquals } from '../stdlib/test' -type testBind = Do<[ - PutStringLn<'Bind & BindTo'>, +interface MyEffect<_a extends number, _b extends string, _c extends unknown> extends Effect {} - Test<'should bind value to function and kind', [ - Bind, () => - AssertEquals>, +export type main = [ + SetEvalEnvironment<'test.node'>, - Bind, AssertEqualsK<[1,2,3]>>, - ]>, + PutStringLn<'====================='>, + PutStringLn<'=== Running tests ==='>, + PutStringLn<'=====================\n\n'>, - Test<'should bind label correctly', [ - BindTo<"value", Pure<{ a: 'b', c: { d: 1 } }>>, + Do<[ + PutStringLn<'Bind & BindTo'>, - Bind, AssertEqualsK<{ a: 'b', c: { d: 1 } }>>, - ]>, + Test<'should bind value to function and kind', [ + Bind, () => + AssertEquals>, - Test<'should bind only inside Do scope', [ - Do<[ - BindTo<"value", Pure<"some value">>, - Bind, AssertEqualsK<"some value">>, + Bind, AssertEqualsK<[1,2,3]>>, ]>, - Bind< - Try, <_>() => Pure<"none">>, - AssertEqualsK<"none"> - >, - ]>, + Test<'should bind label correctly', [ + BindTo<"value", Pure<{ a: 'b', c: { d: 1 } }>>, - Test<'should bind only inside Bind scope', [ - Bind< - BindTo<"value", Pure<"some value">>, - <_>() => Bind, AssertEqualsK<"some value">> - >, + Bind, AssertEqualsK<{ a: 'b', c: { d: 1 } }>>, + ]>, - Bind< - Try, <_>() => Pure<"none">>, - AssertEqualsK<"none"> - >, - ]>, -]> + Test<'should bind only inside Do scope', [ + Do<[ + BindTo<"value", Pure<"some value">>, + Bind, AssertEqualsK<"some value">>, + ]>, -type testExcpt = Do<[ - PutStringLn<'Try/Throw'>, + Bind< + Try, <_>() => Pure<"none">>, + AssertEqualsK<"none"> + >, + ]>, + + Test<'should bind only inside Bind scope', [ + Bind< + BindTo<"value", Pure<"some value">>, + <_>() => Bind, AssertEqualsK<"some value">> + >, - Test<'should return the result of effect', [ - Bind, <_>() => Pure<0>>, - AssertEqualsK<20>>, + Bind< + Try, <_>() => Pure<"none">>, + AssertEqualsK<"none"> + >, + ]>, ]>, - Test<'should return the result of error handler', [ - Bind, Pure<20> ]>, <_>() => Pure<0>>, - AssertEqualsK<0>>, + Do<[ + PutStringLn<'Try/Throw'>, - Bind, Pure<20> ]>, () => Pure>, - AssertEqualsK<"wow">>, - ]>, -]> + Test<'should return the result of effect', [ + Bind, <_>() => Pure<0>>, + AssertEqualsK<20>>, + ]>, -interface MyEffect<_a extends number, _b extends string, _c extends unknown> extends Effect {} -type testFFI = Do<[ - PutStringLn<'FFI'>, + Test<'should return the result of error handler', [ + Bind, Pure<20> ]>, <_>() => Pure<0>>, + AssertEqualsK<0>>, - Test<'should return the result of js expression', [ - Bind, AssertEqualsK<28980>>, + Bind, Pure<20> ]>, () => Pure>, + AssertEqualsK<"wow">>, + ]>, ]>, - Test<'should test custom effect', [ - DefineEffect<'MyEffect', `([a, b, c], ctx) => { - return [ - ctx.getTypeValue(a) * 2, - ctx.getTypeValue(b) + '!', - [...ctx.getTypeValue(c), 'wow'], - ] - }`>, - Bind, AssertEqualsK<[ - 8, "hey!", [1, 2, 'wow'], - ]>>, - ]>, -]> + Do<[ + PutStringLn<'FFI'>, -export type main = [ - SetEvalEnvironment<'test.node'>, + Test<'should return the result of js expression', [ + Bind, AssertEqualsK<28980>>, + ]>, - PutStringLn<'====================='>, - PutStringLn<'=== Running tests ==='>, - PutStringLn<'=====================\n\n'>, - testBind, - testExcpt, - testFFI, + Test<'should test custom effect', [ + DefineEffect<'MyEffect', `([a, b, c], ctx) => { + return [ + ctx.getTypeValue(a) * 2, + ctx.getTypeValue(b) + '!', + [...ctx.getTypeValue(c), 'wow'], + ] + }`>, + Bind, AssertEqualsK<[ + 8, "hey!", [1, 2, 'wow'], + ]>>, + ]>, + ]>, + + PutStringLn<"">, ] -- cgit v1.3.1