fix: lint --clean keeps relates-to note on the typed relation; no orphan warning for preferences; v0.1.4
ci / release (push) Successful in 1m23s

This commit is contained in:
2026-11-22 19:42:41 +01:00
parent dae7313e14
commit e98107dcd7
3 changed files with 45 additions and 12 deletions
+17
View File
@@ -349,6 +349,8 @@ suite "lint":
check "warning: domain/range" in out1
check "warning: orphan entity: d" in out1
check run(d, "lint") == out1 and lastCode == 0
discard run(d, "new", "pref9", "preference")
check "orphan entity: pref9" notin run(d, "lint")
# break things by hand
writeFile(d / "relations.tsv",
"a\tbogus\tb\n" &
@@ -405,6 +407,21 @@ suite "rm guards":
check fileExists(d / "entities" / "b.md")
suite "lint --clean / --suggest":
test "clean appends removed relates-to note to the first typed relation":
let d = freshDir()
seed(d)
discard run(d, "link", "a", "uses", "b", "first")
discard run(d, "link", "b", "part-of", "a", "second")
discard run(d, "link", "a", "relates-to", "b", "extra")
let o = run(d, "lint", "--clean")
check "note appended to a uses b" in o
check "a\tuses\tb\tfirst | extra" in relsText(d)
check "relates-to" notin relsText(d)
discard run(d, "link", "c", "uses", "d")
discard run(d, "link", "c", "relates-to", "d", "n2")
discard run(d, "lint", "--clean")
check "c\tuses\td\tn2" in relsText(d)
test "clean removes tombstones, redundant relates-to and part-of; prints changes":
let d = freshDir()
seed(d)