fish-shell/tests
Fabian Boehm 20243132fb Add <? input redirection
This tries to open the given file to use as stdin, and if it fails,
for any reason, it uses /dev/null instead.

This is useful in cases where we would otherwise do either of these:

```fish
test -r /path/to/file
and string match foo < /path/to/file

cat /path/to/file 2>/dev/null | string match foo
```

This both makes it nicer and shorter, *and* helps with TOCTTOU - what if the file is removed/changed after the check?

The reason for reading /dev/null instead of a closed fd is that a closed fd will often cause an error.

In case opening /dev/null fails, it still skips the command.
That's really a last resort for when the operating system
has turned out to be a platypus and not a unix.

Fixes #4865

(cherry picked from commit df8b9b7095)
2024-04-21 14:35:13 +02:00
..
checks Add <? input redirection 2024-04-21 14:35:13 +02:00
pexpects Disable focus reporting on non-tmux again for now 2024-04-18 10:38:15 +02:00
test_functions isolated-tmux: fix quoting error 2023-09-14 20:42:25 +02:00
.gitignore tweak gitignore rules for *tests* directory 2017-02-20 20:29:43 -08:00
filter-control-sequences.sh tests: filter control sequences only when interactive 2024-04-12 12:28:22 +02:00
history_sample_bash Support $(cmd) command substitution as alternative to (cmd) 2021-07-13 21:33:42 +02:00
history_sample_corrupt1 Improve history robustness against corrupt files 2014-07-29 14:42:03 -07:00
history_sample_fish_1_x Enforce that history items must end with trailing newlines 2021-05-10 14:23:07 -07:00
history_sample_fish_2_0 Enforce that history items must end with trailing newlines 2021-05-10 14:23:07 -07:00
interactive.config Remove some unused functions from the test harness 2020-11-15 09:17:23 +01:00
interactive.fish Only retry failed pexpect tests under CI 2022-10-25 13:40:21 -05:00
test.fish tests: filter control sequences only when interactive 2024-04-12 12:28:22 +02:00
test_driver.sh fix build when path has spaces in it. 2021-10-22 02:27:19 -07:00
test_env.sh tests/test_env.sh: fix copy paste error so we export XDG_RUNTIME_DIR 2021-10-23 18:59:15 +02:00
test_util.fish Run each test fully independently in own environment 2021-08-29 08:56:12 +02:00