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

Function test

example/tests/inject_content_test.js:32–44  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

30
31 // 测试辅助函数
32 async function test(name, fn) {
33 testResults.total++;
34 try {
35 await fn();
36 testResults.passed++;
37 console.log(`%c✓ ${name}`, "color: green;");
38 return true;
39 } catch (error) {
40 testResults.failed++;
41 console.error(`%c✗ ${name}`, "color: red;", error);
42 return false;
43 }
44 }
45
46 // assert(expected, actual, message) - 比较两个值是否相等
47 function assert(expected, actual, message) {

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected