1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-09 16:13:54 +02:00

tests/functional: Make our grep* helpers reject newlines in the query

Newlines behave like *OR*; not "and then".
This commit is contained in:
Robert Hensing 2024-07-16 01:41:22 +02:00
parent f2df3f0c6c
commit 644b97ce25
2 changed files with 21 additions and 3 deletions

View file

@ -108,3 +108,8 @@ unset res
res=$(set -eu -o pipefail; echo foo | expect 1 grepQuietInverse foo | wc -c)
(( res == 0 ))
unset res
# `grepQuiet` does not allow newlines in its arguments, because grep quietly
# treats them as multiple queries.
( echo foo; echo bar; ) | expectStderr -101 grepQuiet $'foo\nbar' \
| grepQuiet -E 'test-infra\.sh:[0-9]+: in call to grepQuiet: newline not allowed in arguments; grep would try each line individually as if connected by an OR operator'