diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2019-03-08 02:32:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-08 02:32:46 -0500 |
| commit | b7a11b486d41de9b2a61225aa211f58cf6d36b88 (patch) | |
| tree | a4b5efef857d7bef0e511bffe8a3daa5c0027507 /testing/asserts.ts | |
| parent | 4b96bfa8c702da9ae2b86400f395f6a571294b38 (diff) | |
testing/asserts: Add unimplemented and unreachable (denoland/deno_std#248)
Original: https://github.com/denoland/deno_std/commit/02274ef48bb298047f2a9a1821a75cd060fc5500
Diffstat (limited to 'testing/asserts.ts')
| -rw-r--r-- | testing/asserts.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testing/asserts.ts b/testing/asserts.ts index 233219b6a..6431a11a5 100644 --- a/testing/asserts.ts +++ b/testing/asserts.ts @@ -283,3 +283,13 @@ export async function assertThrowsAsync( throw new Error(msg); } } + +/** Use this to stub out methods that will throw when invoked. */ +export function unimplemented(msg?: string): never { + throw new Error(msg || "unimplemented"); +} + +/** Use this to assert unreachable code. */ +export function unreachable(): never { + throw new Error("unreachable"); +} |
