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

Function assert

example/tests/gm_api_sync_test.js:77–83  ·  view source on GitHub ↗
(expected, actual, message)

Source from the content-addressed store, hash-verified

75
76 // assert(expected, actual, message) - 比较两个值是否相等
77 function assert(expected, actual, message) {
78 if (expected !== actual) {
79 const valueInfo = `期望 ${JSON.stringify(expected)}, 实际 ${JSON.stringify(actual)}`;
80 const error = message ? `${message} - ${valueInfo}` : `断言失败: ${valueInfo}`;
81 throw new Error(error);
82 }
83 }
84
85 // ============ GM_info 测试 ============
86 console.log("\n%c--- GM_info 测试 ---", "color: orange; font-weight: bold;");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected