2020-06-07 09:20:33 -04:00
|
|
|
import { assert, DenoStdInternalError } from "./assert.ts";
|
|
|
|
import { assertThrows } from "../testing/asserts.ts";
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-06-07 09:20:33 -04:00
|
|
|
name: "assert valid scenario",
|
|
|
|
fn(): void {
|
|
|
|
assert(true);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-06-07 09:20:33 -04:00
|
|
|
name: "assert invalid scenario, no message",
|
|
|
|
fn(): void {
|
|
|
|
assertThrows(() => {
|
|
|
|
assert(false);
|
|
|
|
}, DenoStdInternalError);
|
|
|
|
},
|
|
|
|
});
|
2020-06-12 15:23:38 -04:00
|
|
|
Deno.test({
|
2020-06-07 09:20:33 -04:00
|
|
|
name: "assert invalid scenario, with message",
|
|
|
|
fn(): void {
|
|
|
|
assertThrows(
|
|
|
|
() => {
|
|
|
|
assert(false, "Oops! Should be true");
|
|
|
|
},
|
|
|
|
DenoStdInternalError,
|
|
|
|
"Oops! Should be true"
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|