diff options
author | Chris Knight <cknight1234@gmail.com> | 2020-06-07 14:20:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 09:20:33 -0400 |
commit | 3ef94c5473ac77366d009c7a7c665f695670f886 (patch) | |
tree | 0baa502ca705e9e0a38e013def65f1ab545e643b /std/_util/assert_test.ts | |
parent | adffbacfe49aac480fc34e78035200ab9602443c (diff) |
refactor(std): remove testing dependencies from non-test code (#5838)
Diffstat (limited to 'std/_util/assert_test.ts')
-rw-r--r-- | std/_util/assert_test.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/std/_util/assert_test.ts b/std/_util/assert_test.ts new file mode 100644 index 000000000..38aeae91b --- /dev/null +++ b/std/_util/assert_test.ts @@ -0,0 +1,32 @@ +import { assert, DenoStdInternalError } from "./assert.ts"; +import { assertThrows } from "../testing/asserts.ts"; + +const { test } = Deno; + +test({ + name: "assert valid scenario", + fn(): void { + assert(true); + }, +}); + +test({ + name: "assert invalid scenario, no message", + fn(): void { + assertThrows(() => { + assert(false); + }, DenoStdInternalError); + }, +}); +test({ + name: "assert invalid scenario, with message", + fn(): void { + assertThrows( + () => { + assert(false, "Oops! Should be true"); + }, + DenoStdInternalError, + "Oops! Should be true" + ); + }, +}); |