Skip to content

Commit

Permalink
'main' tests: Don't assume ps(1) is available.
Browse files Browse the repository at this point in the history
It's actually unavailable in the minimal chroots Debian builds our
package on.  That's allowed by POSIX, which specifies ps(1) to be
optional, whereas id(1) —

- is not optional in POSIX
- should exist on every system anyone might run the testsuite on
- has the same length name, so test expectations don't have to be updated
- doesn't take a filename argument (ditto)

That does make the pipeline as a whole somewhat nonsensical
semantically, but it remains just as valid syntactically.
  • Loading branch information
danielshahaf committed Nov 21, 2024
1 parent e0165ea commit 5eb677b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion highlighters/main/test-data/multiple-redirections.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------

BUFFER='ps aux | grep java | sort | uniq | tail | head'
BUFFER='id bob | grep java | sort | uniq | tail | head'

expected_region_highlight=(
"1 2 command" # ps
Expand Down
2 changes: 1 addition & 1 deletion highlighters/main/test-data/simple-redirection.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------

BUFFER='ps aux | grep java'
BUFFER='id bob | grep java'

expected_region_highlight=(
"1 2 command" # ps
Expand Down

1 comment on commit 5eb677b

@danielshahaf
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incidentally, it occurs to me that test cases that are valid syntactically but meaningless semantically might be a good idea in general: they're basically a z-sy-h analogue of lorem ipsum.

Tests that are valid semantically have their place as well, of course… but so do if foo; bar; then and if if foo ; then bar ; else baz ; fi; then, notwithstanding how unreadable one might consider them.

Please sign in to comment.