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

Function assert

example/tests/gm_api_async_test.js:59–65  ·  view source on GitHub ↗
(expected, actual, message)

Source from the content-addressed store, hash-verified

57
58 // assert 函数
59 function assert(expected, actual, message) {
60 if (expected !== actual) {
61 const valueInfo = `期望 ${JSON.stringify(expected)}, 实际 ${JSON.stringify(actual)}`;
62 const error = message ? `${message} - ${valueInfo}` : `断言失败: ${valueInfo}`;
63 throw new Error(error);
64 }
65 }
66
67 // ============ GM.info 测试 ============
68 console.log("\n%c--- GM.info 测试 ---", "color: orange; font-weight: bold;");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected