Merged
Conversation
Introduce a comprehensive golden file test suite that verifies smoosh output is byte-for-byte correct across all modes, formats, and feature combinations. Adds 17 new @test blocks (215 total, up from 198). - test/fixtures/golden-repo/ — 19 fixture files (no .git/) covering docs, code, config, hidden files, edge cases (empty, no-newline, CDATA, deeply nested paths, secrets pattern, unicode-safe content) - test/smoosh_golden.bats — golden test runner with normalise() to strip timestamps and temp paths, UPDATE_GOLDEN=1 to regenerate, and Bash 3.2-compatible chunked test using find + while loop - test/golden/expected/ — 17 committed expected output files covering docs/code/all modes, text/xml/md formats, TOC, line numbers, filter flags (--only, --exclude, --include), chunking, hidden files, and the stdout/stderr outputs (--dry-run, --json, --quiet) - test/ACCEPTANCE.md — manual test runbook for interactive mode, remote repo, NotebookLM, Claude Projects, ChatGPT, secrets detection, agent/CI usage, and golden file regression - CONTRIBUTING.md — UPDATE_GOLDEN=1 workflow documented - README.md — test count updated from 198 to 215 - .gitignore — negation rule for test/fixtures/golden-repo/.env.example Signed-off-by: K1-R1 <77465250+K1-R1@users.noreply.github.com>
Add 13 new golden tests (30 total) and 3 new fixture files to achieve complete byte-level coverage of every deterministic smoosh code path. Format × modifier matrix — fill every cell: - docs-text-toc, docs-text-line-numbers, docs-text-toc-line-numbers - docs-xml-line-numbers, docs-xml-toc-line-numbers Output channel / special mode gaps: - json-dry-run: distinct JSON structure (dry_run:true, files[], no chunks) - code-json: secrets_excluded array populated (aws-creds.py flagged) - no-check-secrets-code-md: aws-creds.py appears when scan is disabled - chunked-text, chunked-xml: header/footer cycling in non-md formats - chunked-quiet: multi-chunk quiet mode outputs one path per chunk - chunked-json: chunks[] array with multiple entries Filter edge case: - exclude-multi-md: comma-separated --exclude patterns New fixture files exercising edge cases: - it's-fine.md: apostrophe in filename (BSD xargs regression guard) - my notes.md: space in filename (path handling through pipeline) - logo.png: 8-byte PNG header (MIME filter rejects in --all mode) - Symlink (link-to-readme) created in setup_file() to test -L exclusion All existing golden files regenerated to include the new fixture content. 228 tests, all passing. Signed-off-by: K1-R1 <77465250+K1-R1@users.noreply.github.com>
Two BSD-vs-GNU portability bugs caused golden file tests to fail on Linux while passing on macOS: 1. BSD sed does not support -- as end-of-options. It treats -- as a literal filename, fails to open it, then processes the real file. The || fallback then also runs, doubling file content in XML CDATA sections. GNU sed supports -- correctly but the doubled-content golden files (generated on macOS) mismatched. Fix: pipe through sed via cat instead of using sed -- file. 2. GNU nl adds a trailing newline to files without one; BSD nl does not. Combined with the unconditional printf '\n' in write_file_entry, this produced an extra blank line on Linux for files like no-newline.md. Fix: capture nl output via $() (which strips trailing newlines) and output with printf '%s', letting the caller's printf '\n' add exactly one. Regenerated all 9 affected golden files. Signed-off-by: K1-R1 <77465250+K1-R1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive acceptance test runbook for
smoosh, expands the golden test fixture repository to cover more scenarios, and improves test coverage and documentation around output correctness and secrets detection. The most important changes are grouped below.Documentation and Testing Improvements
test/ACCEPTANCE.md, covering interactive mode, remote repo processing, AI tool uploads, secrets detection, CI usage, and golden file regression scenarios.README.mdfrom 198 to 228, reflecting new tests and improved file inclusion verification.CONTRIBUTING.mdfor golden file tests, including instructions for regenerating expected outputs and reviewing diffs for intentional changes.Golden Test Fixture Repository Expansion
test/fixtures/golden-repo/including code (app.py,main.go,index.js), docs (README.md,guide.rst,manual.adoc,journal.org,doc.md,it's-fine.md,cdata-break.md), config (Makefile,.env.example,.github/ci.yml), binary (logo.png), and secrets (aws-creds.py) to exercise all smoosh capabilities and edge cases.Output Correctness and Cross-Platform Consistency
add_line_numbersinsmooshto ensure consistent output formatting across GNU and BSDnlimplementations by stripping trailing newlines and usingprintf '%s'.smooshto usecat | sedinstead ofsed -- file, fixing compatibility with BSDsedwhich does not support--as end-of-options.These changes collectively enhance the reliability, coverage, and maintainability of
smoosh's test infrastructure and documentation.