All files / src/compiler/utils assert.js

90.47% Statements 19/21
50% Branches 1/2
50% Functions 1/2
90% Lines 18/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 212x 2x 2x 2x 2x 2x 2x 2x     2x 2x 2x 2x 2x 2x 2x 2x 185x 185x  
import { error } from '../errors.js';
 
/**
 * @template T
 * @param {T} value
 * @returns {asserts value is NonNullable<T>}
 */
export function ok(value) {
	if (!value) error(null, 'INTERNAL', 'Assertion failed');
}
 
/**
 * @template T
 * @param {any} actual
 * @param {T} expected
 * @returns {asserts actual is T}
 */
export function equal(actual, expected) {
	if (actual !== expected) error(null, 'INTERNAL', 'Assertion failed');
}