diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-09 17:12:43 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-09 17:12:43 +0530 |
| commit | efdcf6119e5de99a837189a06a2a23a088432f2d (patch) | |
| tree | 1875530fa513baccc6d3c843a0b0357d8d7bea95 /examples/test-runner.ts | |
| parent | 580ef150778326262d04018460f672bda53d5696 (diff) | |
| download | ts-types-lang-efdcf6119e5de99a837189a06a2a23a088432f2d.tar.gz ts-types-lang-efdcf6119e5de99a837189a06a2a23a088432f2d.zip | |
feat: wow
Diffstat (limited to '')
| -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>, +] |
