diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-14 13:22:39 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-14 13:22:39 +0530 |
| commit | d362ef26db894ea52c6abd34489aa9efdbc0c89b (patch) | |
| tree | 20400ad5ebc70085447e2bb087381aa8c8409afd /stdlib/test.ts | |
| parent | 4746652abfb7aed46627d27a55919d2986885735 (diff) | |
| download | ts-types-lang-d362ef26db894ea52c6abd34489aa9efdbc0c89b.tar.gz ts-types-lang-d362ef26db894ea52c6abd34489aa9efdbc0c89b.zip | |
chore: adds test cases + fixes Test effect scope
Diffstat (limited to 'stdlib/test.ts')
| -rw-r--r-- | stdlib/test.ts | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/stdlib/test.ts b/stdlib/test.ts index 639c433..a592d87 100644 --- a/stdlib/test.ts +++ b/stdlib/test.ts @@ -1,12 +1,29 @@ -import { Effect } from './effect' +import { Do, Effect, Kind1 } from './effect' +import { Throw, Try } from './exception' +import { Equals } from './util' export interface Config { - compileTimeTestFailures: false - stopAtFailure: true // TODO: stopAtFailure + // compileTimeTestFailures: false + // stopAtFailure: true // TODO: stopAtFailure } -type Assertion = Config['compileTimeTestFailures'] extends true ? true : boolean +export interface Assert<_B extends boolean> extends Effect {} + +export interface Test<_m extends string, _effs extends Effect[]> extends Effect {} + +export interface ShowAssertionError<_L extends unknown, _R extends unknown> extends Effect {} + +export type AssertEquals<Left, Right> = Try< + Assert<Equals<Left, Right>>, + <e extends string>() => Do<[ + ShowAssertionError<Left, Right>, + Throw<e>, + ]> +> + +export interface AssertEqualsK<Right extends unknown> extends Kind1 { + return: AssertEquals<this['input'], Right> +} + +// TODO: export interface AssertFails? -export interface Assert<_B extends Assertion> extends Effect {} -export interface Test<_m extends string, _effs extends Effect[]> - extends Effect {} |
