Add test/[ alphabet matrix (mix bash_fixtures.gen test) - #102
Merged
Conversation
Enumerate every POSIX test/[ operator across revealing operand shapes, the same way date_matrix and printf_matrix already work. Both test and [ are asked on a representative subset so they cannot drift. Gaps are marked with reasons rather than omitted; recordings were taken from GNU bash 5.2 via runner.sh. Co-authored-by: Dave Lucia <davelucianyc@gmail.com>
Split the post-recording gap classifier into file-shape, operator, and syntax helpers so cyclomatic complexity stays under the limit. Co-authored-by: Dave Lucia <davelucianyc@gmail.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.
Implements #70 item 2 for test / [ only: a generated
test_matrixsuite in the same generate / record / test path asdate_matrixandprintf_matrix.This is not the item-3 filesystem-shape × command cube (~480 cells). Operators are crossed with revealing operand shapes for that operator so padding/boundaries/false-vs-missing stay visible — the date lesson — without enumerating every FS command.
What was enumerated
mix bash_fixtures.gen testwrites 246 cases:[operator list ontest:-b -c -d -e -f -g -h -k -L -n -p -r -S -s -t -u -w -x -z,===!=<>,-eq -ne -lt -le -gt -ge,-nt -ot -ef,-a -o,!, plus bash extras-G -O -N/dev/null, trailing-slash and ENOTDIR boundaries-z/-nand one-arg forms at empty /hi/0/ space (and operator-as-operand)hi/hivsa/b,0/1vs10/9)testand[on a representative subset (-e/-f/-d/-L/-s,-z/-n,=/!=,-eq/-lt,!, one-arg) so the two spellings cannot drift], groupingmix bash_fixtures.gen test --dry-runreportstest_matrix: 246 cases.mix bash_fixtures.gennow generates date, printf, and test.Recording
Docker was not available on the agent VM. Oracle output was recorded with the same
test/fixtures/runner.shthe Docker task runs, under GNU bash 5.2.21 / Ubuntu 24.04 (uidubuntu, not root — sochmod 000permission cells are meaningful), then pretty-printed throughMix.Tasks.BashFixtures.write_json!/2:To re-record through Docker when it is available:
Known gaps (44 of 246)
No cell was omitted. Divergences are
opts.known_gap(excluded from the digest). The fixture runner still executes them with the assertion inverted.-r/-w/-xare existence checks; bash tests the permission bit (-xon a 644 file,-r/-wonchmod 000)7) —Integer.parse/1rejects them-eqfamily: JustBash exits 2 with no diagnostic; bash writes stderr-nt/-ot/-efunimplemented (revealing true side: newer-than, older-than, same-file, hardlink)[without a closing]still evaluates; bash exits 2( )grouping unimplemented/dev/nulltyped as a regular file; bash reports a character device (-f,-c)-Z,-xx): exit 1 vs bash exit 2 + diagnostic-O/-Gunimplemented (true on a file we own)test -s diris false-ais not a synonym of-e-f file -a -d diris not expression AND/ORJustBash.exec/2 did not raise on any cell. No
test/[implementation bugs were fixed in this PR — it is the enumeration + harness.Cheap follow-ups the matrix now makes un-skippable
-x/-r/-wshould consult mode bits, not existence-c/ character-device type for/dev/null(and stop reporting it as-f)-nt/-ot/-ef[missing-]and unknown-operator diagnostics (exit 2)-aas-e; 4-arg-a/-oas expression AND/ORtest -s diris trueNot in this PR: the item-3 FS-shape × command cube, Oils activation, CI topology changes.
Tests
All local quality gates passed:
mix compile --warnings-as-errorsmix format --check-formattedmix credo --strict(only the existing intentionalbanned_fixture_applyfinding)mix dialyzer(zero new errors)mix test— 6346 tests, 0 failuresmix test --only suite:test_matrix— 246 tests, 0 failuresmix bash_fixtures.gen test --dry-run—test_matrix: 246 casesRelated Issues
Related to #70 (item 2, test/[ only; not closing the issue)
Type of Change
Testing
mix bash_fixtures.gen test --dry-run, local runner.sh recording, JustBash vs oracle classification)Checklist
mix formatmix credoand addressed any issues