summaryrefslogtreecommitdiff
path: root/testing/README.md
blob: 70968e3c74cd93a5f62b9bfe53f471c4b0f8ac4a (plain)
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
# Testing

## Usage

```ts
import {
  test,
  assert,
  equal,
  assertEqual
} from "https://deno.land/x/testing/mod.ts";

test({
  name: "testing example",
  fn() {
    assert(equal("world", "world"));
    assert(!equal("hello", "world"));
    assert(equal({ hello: "world" }, { hello: "world" }));
    assert(!equal({ world: "hello" }, { hello: "world" }));
    assertEqual("world", "world");
    assertEqual({ hello: "world" }, { hello: "world" });
  }
});
```

Short syntax (named function instead of object):

```ts
test(function example() {
  assert(equal("world", "world"));
  assert(!equal("hello", "world"));
  assert(equal({ hello: "world" }, { hello: "world" }));
  assert(!equal({ world: "hello" }, { hello: "world" }));
  assertEqual("world", "world");
  assertEqual({ hello: "world" }, { hello: "world" });
});
```