2019-01-06 14:19:15 -05:00
|
|
|
# Testing
|
2019-01-03 14:16:15 -05:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```ts
|
2019-01-06 14:19:15 -05:00
|
|
|
import {
|
|
|
|
test,
|
|
|
|
assert,
|
|
|
|
equal,
|
|
|
|
assertEqual
|
|
|
|
} from "https://deno.land/x/testing/mod.ts";
|
2019-01-03 14:16:15 -05:00
|
|
|
|
|
|
|
test({
|
2019-01-06 14:19:15 -05:00
|
|
|
name: "testing example",
|
2019-01-03 14:16:15 -05:00
|
|
|
fn() {
|
|
|
|
assert(equal("world", "world"));
|
|
|
|
assert(!equal("hello", "world"));
|
|
|
|
assert(equal({ hello: "world" }, { hello: "world" }));
|
|
|
|
assert(!equal({ world: "hello" }, { hello: "world" }));
|
|
|
|
assertEqual("world", "world");
|
2019-01-06 14:19:15 -05:00
|
|
|
assertEqual({ hello: "world" }, { hello: "world" });
|
|
|
|
}
|
2019-01-03 14:16:15 -05:00
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
Short syntax (named function instead of object):
|
2019-01-06 14:19:15 -05:00
|
|
|
|
2019-01-03 14:16:15 -05:00
|
|
|
```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");
|
2019-01-06 14:19:15 -05:00
|
|
|
assertEqual({ hello: "world" }, { hello: "world" });
|
2019-01-03 14:16:15 -05:00
|
|
|
});
|
2019-01-04 05:09:42 -05:00
|
|
|
```
|