2021-01-10 21:59:07 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
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,
|
2020-07-14 15:24:17 -04:00
|
|
|
"Oops! Should be true",
|
2020-06-07 09:20:33 -04:00
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|