aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/test-runner.ts39
1 files changed, 12 insertions, 27 deletions
diff --git a/examples/test-runner.ts b/examples/test-runner.ts
index fecd3e4..3302fbb 100644
--- a/examples/test-runner.ts
+++ b/examples/test-runner.ts
@@ -1,44 +1,29 @@
-import { Do, Effect } from '../stdlib/effect'
-import { PutStringLn } from '../stdlib/stdio'
-import { DefineEffect } from '../stdlib/sys'
+import { Do, Kind1 } from '../stdlib/effect'
+import { Print, PutStringLn } from '../stdlib/stdio'
+import { SetEvalEnvironment } from '../stdlib/sys'
+import { Test, Assert } from '../stdlib/test'
+import { Equals, Not } from '../stdlib/util'
-type Test<m extends string, effs extends Effect[]> = [
- PutStringLn<`* ${m}`>,
- ...effs,
-]
-
-type Equals<Left, Right> =
- [Left] extends [Right] ? ([Right] extends [Left] ? true : false) : false
-
-type Not<B extends boolean> = B extends true ? false : true
-
-interface TestConfig {
- CompileTestFailures: false
+interface PrintK extends Kind1 {
+ return: Print<this['input']>
}
-type Assertion = TestConfig['CompileTestFailures'] extends true ? true : boolean
-interface Assert<_B extends Assertion> extends Effect { }
-
export type main = [
- DefineEffect<'Assert', `([b], ctx) => {
- if (!ctx.getTypeValue(b)) {
- throw new Error('AAAAAAA')
- }
- }`>,
+ SetEvalEnvironment<'test.node'>,
PutStringLn<"Running tests...">,
Do<[
- ...Test<"should do some stuff", [
- Assert<Equals<1, 1>>,
+ Test<"should do some stuff", [
+ Assert<Equals<1, 2>>,
Assert<Not<Equals<2, 1>>>,
]>,
- ...Test<"hello world", [
+ Test<"hello world", [
Assert<Equals<1, 1>>,
]>,
- ...Test<"should do some other stuff", [
+ Test<"should do some other stuff", [
Assert<Equals<1, 1>>,
]>,
]>,