Add tests for 8 untested public functions, fix doc typo#2
Conversation
There was a problem hiding this comment.
Build & Tests
Build: passes cleanly.
Tests: all 33 pass (18 pre-existing + 15 new), zero failures. CI green on both macOS and Ubuntu.
Findings
Typo fix: "cheks" → "checks" in has-extension? doc string — correct.
All 15 new test assertions verified against implementations:
spliton"path/to/file"and"/usr/bin"(leading empty segment) — correct.joinround-trips correctly withString.join "/".filenamereturns(Just @"file.txt")for normal paths and(Just @"")for empty string — correct per actual behavior.split-extensionon"file.txt","file"(Nothing), and"file/path.txt.bob.fred"(gets last extension) — correct per the#"\.[^/\.]*$"regex.replace-extensionwith and without existing extension — correct.separator?andsearch-path-separator?— correct.split-search-pathon":"— correct.
filename "" doc discrepancy: The doc claims Nothing for empty input, but (split "") returns [@""] (one-element array), so Array.last yields (Just @""). The test correctly documents actual behavior. PR description acknowledges this and defers the fix — reasonable.
Notable untested edge cases (not blocking, but worth noting for follow-up):
filename "path/to/"(trailing slash →(Just @"")).split-extension ".bashrc"(dotfile — regex would match.bashrcas extension, giving(Pair "" "bashrc")).split "",join &[],split-search-path "".
Verdict: merge
All tests are correct, typo fix is correct, CI green. The filename "" doc discrepancy is a pre-existing issue appropriately documented but deferred.
Summary
split,join,filename,split-extension,replace-extension,separator?,search-path-separator?, andsplit-search-path— all previously untestedhas-extension?doc stringTest count goes from 18 to 33 (all passing). Note:
filename ""returns(Just @"")rather thanNothingas the doc claims — tests document the actual behaviour; the doc discrepancy could be addressed separately.Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.