1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00
denoland-deno/testing
2019-01-09 10:32:37 -05:00
..
mod.ts feat: print test status on the same line as test name (denoland/deno_std#100) 2019-01-09 10:32:37 -05:00
README.md Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
test.ts Add testing module 2019-01-02 13:45:42 -05:00

Testing

Usage

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):

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" });
});