Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion scripts/unused_pub_detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,34 @@
const fs = require("fs"), path = require("path");
const SRC = path.resolve(__dirname, "..", "src");
const EXTERNAL = new Set(["std","builtin","sqlite","msgpack","httpx"]);
const TEST_RE = /_(?:test|property_test|thread_safety_test|perf_test|leak_test)\.zig$|test_helpers\.zig$|_test_helpers\.zig$|timed_test_runner\.zig$|msgpack_test_helpers\.zig$|checkpoint_test_helpers\.zig$|app_test_helpers\.zig$|store_test_helpers\.zig$|test_all\.zig$/;
// Boundary-aware test-path classification on canonical paths ("src/foo_test.zig"):
// *_test.zig suffix, test_all.zig, *test_helper(s).zig, *test_runner.zig.
// Does NOT match ordinary production names such as "latest.zig".
const TEST_RE = /(?:^|\/)(?:[^/]+_test\.zig|test_all\.zig|(?:[^/]+[-_])?test[-_](?:helper|runner)[^/]*\.zig)$/;

if (process.argv.includes("--selftest")) {
const cases = [
["src/logging_test.zig", true],
["src/test_all.zig", true],
["src/app_test_helpers.zig", true],
["src/schema/test_helpers.zig", true],
["src/timed_test_runner.zig", true],
["src/latest.zig", false],
["src/contest_helpers.zig", false],
["src/latest_runner.zig", false],
["src/main.zig", false],
["src/server.zig", false],
];
for (const [p, expected] of cases) {
const actual = TEST_RE.test(p);
if (actual !== expected) {
console.error(`FAIL: TEST_RE("${p}") = ${actual}, expected ${expected}`);
process.exit(1);
}
}
console.log("selftest: all path classifications OK");
process.exit(0);
}

function log(m) { process.stderr.write(m + "\n"); }

Expand Down
206 changes: 0 additions & 206 deletions src/checkpoint_worker_property_test.zig

This file was deleted.

Loading
Loading