MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / assertThrowsOrKeepsValue

Function assertThrowsOrKeepsValue

example/tests/sandbox_test.js:78–90  ·  view source on GitHub ↗
(assign, read, expected, message)

Source from the content-addressed store, hash-verified

76 }
77
78 function assertThrowsOrKeepsValue(assign, read, expected, message) {
79 let threw = false;
80 try {
81 assign();
82 } catch {
83 threw = true;
84 }
85 assertSame(
86 expected,
87 read(),
88 `${message}${threw ? "(赋值抛出,值保持不变)" : ""}`,
89 );
90 }
91
92 async function test(name, fn) {
93 testResults.total++;

Callers 1

sandbox_test.jsFile · 0.85

Calls 1

assertSameFunction · 0.70

Tested by

no test coverage detected