diff options
Diffstat (limited to 'examples/test-runner.ts')
| -rw-r--r-- | examples/test-runner.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/test-runner.ts b/examples/test-runner.ts new file mode 100644 index 0000000..c0eb4c4 --- /dev/null +++ b/examples/test-runner.ts @@ -0,0 +1,35 @@ +import { DefineEffect, Do, Effect, Print, PutString, PutStringLn } from '../stdlib' + +type Testi<m extends string, effs extends Effect[]> = [ + PutStringLn<m>, + ...effs, +] + +type Equals<Left, Right> = + [Left] extends [Right] ? ([Right] extends [Left] ? true : false) : false + +interface Assert<_B extends true> extends Effect { } + +type testCases = [ + ...Testi<"should do some stuff", [ + Assert<Equals<1, 2>>, + ]>, + + ...Testi<"hello world", [ + Print<2>, + ]>, + + ...Testi<"should do some other stuff", [ + Print<5>, + ]>, +] + +export type main = [ + DefineEffect<'Assert', `(b) => { + if (!b.getLiteralValue()) { + throw new Error('AAAAAAA') + } + }`>, + PutStringLn<"Running tests...">, + Do<testCases>, +] |
