mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 16:49:18 -05:00
30 lines
599 B
TypeScript
30 lines
599 B
TypeScript
import { assert, DenoStdInternalError } from "./assert.ts";
|
|
import { assertThrows } from "../testing/asserts.ts";
|
|
|
|
Deno.test({
|
|
name: "assert valid scenario",
|
|
fn(): void {
|
|
assert(true);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "assert invalid scenario, no message",
|
|
fn(): void {
|
|
assertThrows(() => {
|
|
assert(false);
|
|
}, DenoStdInternalError);
|
|
},
|
|
});
|
|
Deno.test({
|
|
name: "assert invalid scenario, with message",
|
|
fn(): void {
|
|
assertThrows(
|
|
() => {
|
|
assert(false, "Oops! Should be true");
|
|
},
|
|
DenoStdInternalError,
|
|
"Oops! Should be true"
|
|
);
|
|
},
|
|
});
|