1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
denoland-deno/testing/README.md

32 lines
814 B
Markdown
Raw Normal View History

2019-01-03 14:16:15 -05:00
# Testing
## Usage
```ts
2019-01-04 05:09:42 -05:00
import { test, assert, equal, assertEqual } from 'https://deno.land/x/testing/mod.ts';
2019-01-03 14:16:15 -05:00
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"});
});
2019-01-04 05:09:42 -05:00
```