mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
tests/functional: add assertStderr function
Currently there isn't a convenient way to check for multiline output. In addition, these outputs will easily change and having a diff between the expected an the actual output upon failures is convenient.
This commit is contained in:
parent
87741dbd21
commit
9fac62435c
1 changed files with 11 additions and 0 deletions
|
@ -216,6 +216,17 @@ expectStderr() {
|
|||
return 0
|
||||
}
|
||||
|
||||
# Run a command and check whether the stderr matches stdin.
|
||||
# Show a diff when output does not match.
|
||||
# Usage:
|
||||
#
|
||||
# assertStderr nix profile remove nothing << EOF
|
||||
# error: This error is expected
|
||||
# EOF
|
||||
assertStderr() {
|
||||
diff -u /dev/stdin <($@ 2>/dev/null 2>&1)
|
||||
}
|
||||
|
||||
needLocalStore() {
|
||||
if [[ "$NIX_REMOTE" == "daemon" ]]; then
|
||||
skipTest "Can’t run through the daemon ($1)"
|
||||
|
|
Loading…
Reference in a new issue