2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2024-06-03 13:30:20 +00:00
|
|
|
import { AssertionError, assertThrows, unreachable } from "./mod.ts";
|
2023-07-13 07:04:30 +00:00
|
|
|
|
2024-06-03 13:30:20 +00:00
|
|
|
Deno.test("unreachable()", () => {
|
2024-06-03 13:33:17 +00:00
|
|
|
assertThrows(() => unreachable(), AssertionError, "Unreachable.");
|
2024-06-03 13:30:20 +00:00
|
|
|
assertThrows(
|
|
|
|
() => unreachable("custom message"),
|
|
|
|
AssertionError,
|
2024-06-03 13:33:17 +00:00
|
|
|
"Unreachable: custom message",
|
2024-06-03 13:30:20 +00:00
|
|
|
);
|
2024-02-28 18:58:02 +00:00
|
|
|
});
|