From aee5d90a2397e68a753ab05e20566d0a23604931 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Jan 2023 17:15:22 +0530 Subject: chore: prettier --- tests/builtins.spec.ts | 162 ++++++++++++++++++++++++++++++------------------- 1 file changed, 100 insertions(+), 62 deletions(-) (limited to 'tests/builtins.spec.ts') diff --git a/tests/builtins.spec.ts b/tests/builtins.spec.ts index cbac0d3..31e2cc0 100644 --- a/tests/builtins.spec.ts +++ b/tests/builtins.spec.ts @@ -4,7 +4,8 @@ import { PutStringLn } from '../stdlib/stdio' import { DefineEffect, JsExpr, SetEvalEnvironment } from '../stdlib/sys' import { Test, AssertEqualsK, AssertEquals } from '../stdlib/test' -interface MyEffect<_a extends number, _b extends string, _c extends unknown> extends Effect {} +interface MyEffect<_a extends number, _b extends string, _c extends unknown> + extends Effect {} export type main = [ SetEvalEnvironment<'test.node'>, @@ -13,84 +14,121 @@ export type main = [ PutStringLn<'=== Running tests ==='>, PutStringLn<'=====================\n\n'>, - Do<[ - PutStringLn<'Bind & BindTo'>, + Do< + [ + PutStringLn<'Bind & BindTo'>, - Test<'should bind value to function and kind', [ - Bind, () => - AssertEquals>, + Test< + 'should bind value to function and kind', + [ + Bind< + Pure<[1, 2, 3]>, + () => AssertEquals + >, - Bind, AssertEqualsK<[1,2,3]>>, - ]>, - - Test<'should bind label correctly', [ - BindTo<"value", Pure<{ a: 'b', c: { d: 1 } }>>, - - Bind, AssertEqualsK<{ a: 'b', c: { d: 1 } }>>, - ]>, - - Test<'should bind only inside Do scope', [ - Do<[ - BindTo<"value", Pure<"some value">>, - Bind, AssertEqualsK<"some value">>, - ]>, - - Bind< - Try, <_>() => Pure<"none">>, - AssertEqualsK<"none"> + Bind, AssertEqualsK<[1, 2, 3]>> + ] >, - ]>, - Test<'should bind only inside Bind scope', [ - Bind< - BindTo<"value", Pure<"some value">>, - <_>() => Bind, AssertEqualsK<"some value">> + Test< + 'should bind label correctly', + [ + BindTo<'value', Pure<{ a: 'b'; c: { d: 1 } }>>, + + 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'>> + ] + >, + + Bind< + Try, <_>() => Pure<'none'>>, + AssertEqualsK<'none'> + > + ] >, - ]>, - ]>, - Do<[ - PutStringLn<'Try/Throw'>, + Test< + 'should bind only inside Bind scope', + [ + Bind< + BindTo<'value', Pure<'some value'>>, + <_>() => Bind, AssertEqualsK<'some value'>> + >, + + Bind< + Try, <_>() => Pure<'none'>>, + AssertEqualsK<'none'> + > + ] + > + ] + >, - Test<'should return the result of effect', [ - Bind, <_>() => Pure<0>>, - AssertEqualsK<20>>, - ]>, + Do< + [ + PutStringLn<'Try/Throw'>, - Test<'should return the result of error handler', [ - Bind, Pure<20> ]>, <_>() => Pure<0>>, - AssertEqualsK<0>>, + Test< + 'should return the result of effect', + [Bind, <_>() => Pure<0>>, AssertEqualsK<20>>] + >, - Bind, Pure<20> ]>, () => Pure>, - AssertEqualsK<"wow">>, - ]>, - ]>, + Test< + 'should return the result of error handler', + [ + Bind< + Try, Pure<20>]>, <_>() => Pure<0>>, + AssertEqualsK<0> + >, + + Bind< + Try, Pure<20>]>, () => Pure>, + AssertEqualsK<'wow'> + > + ] + > + ] + >, - Do<[ - PutStringLn<'FFI'>, + Do< + [ + PutStringLn<'FFI'>, - Test<'should return the result of js expression', [ - Bind, AssertEqualsK<28980>>, - ]>, + Test< + 'should return the result of js expression', + [Bind, AssertEqualsK<28980>>] + >, - Test<'should test custom effect', [ - DefineEffect<'MyEffect', `([a, b, c], ctx) => { + 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<"">, + }` + >, + Bind< + MyEffect<4, 'hey', [1, 2]>, + AssertEqualsK<[8, 'hey!', [1, 2, 'wow']]> + > + ] + > + ] + >, + + PutStringLn<''> ] -- cgit v1.3.1