2020-09-21 08:26:41 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-11-09 09:25:13 -05:00
|
|
|
export { AssertionError } from "./assertion_error.ts";
|
2020-08-18 14:15:59 -04:00
|
|
|
import {
|
2020-11-09 09:25:13 -05:00
|
|
|
assertEquals as deepStrictEqual,
|
|
|
|
AssertionError,
|
|
|
|
assertMatch as match,
|
|
|
|
assertNotEquals as notDeepStrictEqual,
|
|
|
|
assertNotStrictEquals as notStrictEqual,
|
|
|
|
assertStrictEquals as strictEqual,
|
|
|
|
assertThrows as throws,
|
|
|
|
fail,
|
2020-08-18 14:15:59 -04:00
|
|
|
} from "../testing/asserts.ts";
|
|
|
|
|
2020-11-09 09:25:13 -05:00
|
|
|
function assert(expr: unknown, msg = ""): asserts expr {
|
|
|
|
if (!expr) {
|
|
|
|
throw new AssertionError(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const ok = assert;
|
|
|
|
export default assert;
|
2020-09-14 10:22:07 -04:00
|
|
|
|
2020-11-09 09:25:13 -05:00
|
|
|
Object.assign(assert, {
|
|
|
|
deepStrictEqual,
|
2020-08-20 11:56:31 -04:00
|
|
|
fail,
|
2020-11-09 09:25:13 -05:00
|
|
|
match,
|
|
|
|
notDeepStrictEqual,
|
|
|
|
notStrictEqual,
|
|
|
|
ok,
|
|
|
|
strictEqual,
|
|
|
|
throws,
|
|
|
|
});
|
2020-08-18 14:15:59 -04:00
|
|
|
|
2020-11-09 09:25:13 -05:00
|
|
|
export {
|
|
|
|
deepStrictEqual,
|
|
|
|
fail,
|
|
|
|
match,
|
|
|
|
notDeepStrictEqual,
|
|
|
|
notStrictEqual,
|
|
|
|
ok,
|
|
|
|
strictEqual,
|
|
|
|
throws,
|
|
|
|
};
|