Skip to content

Make the demo output newline contract explicit - #101

Open
Fiddlehead-MB wants to merge 1 commit into
NateBJones-Projects:mainfrom
Fiddlehead-MB:fix/demo-output-exact-bytes
Open

Make the demo output newline contract explicit#101
Fiddlehead-MB wants to merge 1 commit into
NateBJones-Projects:mainfrom
Fiddlehead-MB:fix/demo-output-exact-bytes

Conversation

@Fiddlehead-MB

Copy link
Copy Markdown

The observed failure

The built-in demo says each output file must contain exact text, but its checks use shell command substitution:

test "$(cat alpha.txt 2>/dev/null)" = "alpha ready"

Command substitution removes trailing newline bytes. As a result, the current check cannot distinguish alpha ready with no newline, one newline, or multiple trailing newlines. It can report PASS for outputs that are not byte-for-byte identical.

The proposed fix

  • Propose one LF as the explicit ending for each one-line demo output.
  • Compare the expected bytes using printf ... | diff -u - file.
  • Keep the README example on the same contract.
  • Add regression coverage for the proposed contract.

Proposing one LF for these one-line files — happy to match a different convention if the project prefers.

The change is limited to the built-in demo, the README example, and one test. It does not change worker invocation or general check execution.

Verification

alpha.txt bytes Expected result
b"alpha ready" FAIL
b"alpha ready\n" PASS
b"alpha ready\n\n" FAIL
b"alpha ready." FAIL
File missing FAIL

Executed proof

RINGER_NO_SELF_UPDATE=1 python3 -m unittest discover -s tests

All 254 tests pass on Python 3.12.3.

Related: #31 touches the demo wording but doesn't change the comparison logic — this fix is independent of it. Happy to rebase if #31 lands first.

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