fix: strip wc whitespace in unit tests for macOS compatibility#20
Merged
glauberlima merged 1 commit intomainfrom Feb 23, 2026
Merged
fix: strip wc whitespace in unit tests for macOS compatibility#20glauberlima merged 1 commit intomainfrom
glauberlima merged 1 commit intomainfrom
Conversation
macOS `wc` pads output with leading spaces (e.g. " 15"), causing string equality comparisons against bare integers to fail. Wrap each `wc` call in `$(( ... ))` to strip whitespace via arithmetic expansion. Also includes install.sh refactors: extract cleanup_temp/validate_json helpers, use array for component results, and simplify step counter increments with `$((++current_step))`.
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.
Summary
wc -mandwc -lcalls in$(( ... ))to strip macOS leading-space padding before string comparison in unit testscleanup_tempandvalidate_jsonhelpers ininstall.shto eliminate duplicated inline logicxargsstring join with bash array inprompt_component_selection$((++current_step))Root Cause
macOS
wcpads numeric output with leading spaces (e.g." 15") whileBAR_WIDTHis a bare integer ("15"). Thetest()function uses string equality (==), so comparisons always failed on macOS despite correct numeric values.Test plan
./tests/unit.sh— all 68 tests pass (previously 3 failing)./tests/integration.sh— all 25 tests pass./tests/shellcheck.sh— zero warnings🤖 Generated with Claude Code