P-0000: FORMAT.md v1, Prüfskript check_format.py, Viewer-Kopie mit Hinweis bei neuerer Formatversion, Tests format2lint
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
15
viewer/tests/format2lint.3.mjs
Normal file
15
viewer/tests/format2lint.3.mjs
Normal file
@ -0,0 +1,15 @@
|
||||
// format2lint.3 (Logikteil): erkennt der Viewer-Parser eine neuere Formatversion?
|
||||
// Aufruf: node viewer/tests/format2lint.3.mjs (Node 24: TypeScript-Quellen laufen direkt)
|
||||
import { readFileSync } from "node:fs";
|
||||
import { formatVersion, isNewerFormat, parseDoc, VIEWER_FORMAT } from "../src/lib/roadmap.ts";
|
||||
|
||||
let ok = true;
|
||||
const prüfe = (name, bed, notiz) => { ok &&= bed; console.log(`- ${name}: ${bed ? "✓" : "✗"} ${notiz}`); };
|
||||
|
||||
const echt = parseDoc(readFileSync(new URL("../../ROADMAP.md", import.meta.url), "utf-8"));
|
||||
prüfe("format2lint.3a", formatVersion(echt.head) === 1 && !isNewerFormat(echt.head), `echte ROADMAP.md: Format ${formatVersion(echt.head)}, nicht neuer (Viewer versteht bis ${VIEWER_FORMAT})`);
|
||||
const neu = parseDoc("# X\n\nStand: 2026-11-03 · Projekt-ID: P-0001 · Format: 2 · Nächste freie ID: #1003\n\n## 1. Todo\n- [#1001] a\n");
|
||||
prüfe("format2lint.3b", isNewerFormat(neu.head) && formatVersion(neu.head) === 2, "Format 2 wird als neuer erkannt");
|
||||
prüfe("format2lint.3c", !isNewerFormat(parseDoc("# X\n\nStand: heute\n\n## 1. Todo\n").head), "ohne Format-Zeile (Format 0): nicht neuer");
|
||||
prüfe("format2lint.3d", !isNewerFormat(parseDoc("# X\n\nFormat: abc\n").head), "Format ohne Zahl: nicht als neuer behandelt");
|
||||
process.exit(ok ? 0 : 1);
|
||||
Reference in New Issue
Block a user