mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-16 07:15:24 +00:00
vscode: add equality assertion
This commit is contained in:
parent
9cf2577054
commit
3ad0574d7e
2 changed files with 12 additions and 2 deletions
|
@ -11,6 +11,16 @@ export function assert(condition: unknown, explanation: string): asserts conditi
|
|||
}
|
||||
}
|
||||
|
||||
assert.eq = <T>(bibba: unknown, bobba: T, explanation: string): asserts bibba is T => {
|
||||
try {
|
||||
nativeAssert.strictEqual(bibba, bobba, explanation);
|
||||
} catch (err) {
|
||||
log.error(`Equality assertion failed:`, explanation);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const log = {
|
||||
enabled: true,
|
||||
debug(message?: any, ...optionalParams: any[]): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue