Skip to content

Add tests for 8 untested public functions, fix doc typo#2

Merged
hellerve merged 1 commit into
masterfrom
claude/add-tests-fix-typo
Jun 16, 2026
Merged

Add tests for 8 untested public functions, fix doc typo#2
hellerve merged 1 commit into
masterfrom
claude/add-tests-fix-typo

Conversation

@carpentry-agent

Copy link
Copy Markdown

Summary

  • Add tests for split, join, filename, split-extension, replace-extension, separator?, search-path-separator?, and split-search-path — all previously untested
  • Fix "cheks" → "checks" typo in has-extension? doc string

Test count goes from 18 to 33 (all passing). Note: filename "" returns (Just @"") rather than Nothing as 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.

@carpentry-reviewer carpentry-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • split on "path/to/file" and "/usr/bin" (leading empty segment) — correct.
  • join round-trips correctly with String.join "/".
  • filename returns (Just @"file.txt") for normal paths and (Just @"") for empty string — correct per actual behavior.
  • split-extension on "file.txt", "file" (Nothing), and "file/path.txt.bob.fred" (gets last extension) — correct per the #"\.[^/\.]*$" regex.
  • replace-extension with and without existing extension — correct.
  • separator? and search-path-separator? — correct.
  • split-search-path on ":" — 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 .bashrc as 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.

@hellerve hellerve merged commit 731f8c5 into master Jun 16, 2026
2 checks passed
@hellerve hellerve deleted the claude/add-tests-fix-typo branch June 16, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant