aboutsummaryrefslogtreecommitdiff
path: root/examples/test-runner.ts
blob: 7dc196670253f575eac5e935c155a2c6df8b55cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Do } from '../stdlib/effect'
import { PutStringLn } from '../stdlib/stdio'
import { SetEvalEnvironment } from '../stdlib/sys'
import { Test, Assert } from '../stdlib/test'
import { Equals, Not } from '../stdlib/util'

type testSomeStuff = Do<
  [
    PutStringLn<'Some Stuff'>,

    Test<
      'should do some stuff',
      [Assert<Equals<1, 1>>, Assert<Not<Equals<2, 1>>>]
    >,

    Test<'bing bong, bing bing bong', [Assert<Equals<1, 1>>]>
  ]
>

type testSomeMoreStuff = Do<
  [
    PutStringLn<'Other stuff?'>,

    Test<'should do some other stuff', [Assert<Equals<[1, 2, 3], [1, 2, 3]>>]>

    // Test<"this'll fail fo sho", [
    //   Assert<Equals<[1, 2, 3], [4, 5, 6]>>,
    // ]>,
  ]
>

export type main = [
  // Update env to node with test helpers
  SetEvalEnvironment<'test.node'>,

  PutStringLn<'=== Running tests... ===\n'>,

  testSomeStuff,
  testSomeMoreStuff
]