Skip to content

test(snapshot): cover the placeholder matcher and normalization internals#822

Merged
Chemaclass merged 1 commit into
mainfrom
test/snapshot-internals
Jul 16, 2026
Merged

test(snapshot): cover the placeholder matcher and normalization internals#822
Chemaclass merged 1 commit into
mainfrom
test/snapshot-internals

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

assert_match_snapshot's end-to-end paths are tested, but the internals defining snapshot semantics — the ::ignore:: placeholder matcher, normalization, path resolution — had no direct coverage.

💡 Changes

  • normalize_actual: CR stripping, trailing-newline trim, inner blank lines preserved.
  • match_with_placeholder: mid-line and multi-line ::ignore::, non-matching fixed text rejected, regex metacharacters in snapshots stay literal, custom BASHUNIT_SNAPSHOT_PLACEHOLDER honoured.
  • resolve_file: explicit hint used verbatim.

…nals

assert_match_snapshot's end-to-end paths were tested, but the internals that
define snapshot semantics were not. Pin them:

- normalize_actual: strips CR and trailing newlines, keeps inner blank lines
- match_with_placeholder: ::ignore:: in the middle of a line, spanning
  multiple lines, rejecting non-matching fixed text, regex metacharacters in
  snapshots treated literally, and BASHUNIT_SNAPSHOT_PLACEHOLDER overrides
- resolve_file: an explicit path hint is used verbatim
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 16, 2026
@Chemaclass Chemaclass self-assigned this Jul 16, 2026
@Chemaclass
Chemaclass merged commit 1a34fc1 into main Jul 16, 2026
34 of 37 checks passed
@Chemaclass
Chemaclass deleted the test/snapshot-internals branch July 16, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant