tests/file-tests: check stderr as well

This commit is contained in:
Lukáš Zaoral 2023-02-02 10:26:34 +01:00 committed by vmihalko
parent f73b7d1ec8
commit f4e6172807
2 changed files with 6 additions and 2 deletions

View File

@ -15,12 +15,14 @@ printf $'#!/bin/bash
compare() {
IN="db/$1"
OUT="$TMPDIR/out"
rlRun "file \'$IN\' > \'$OUT\'" "0" "Run file on $1"
ERR="$TMPDIR/err"
rlRun "file \'$IN\' > \'$OUT\' 2> \'$ERR\'" "0" "Run file on $1"
sed -i "s|^$IN: ||" "$OUT"
REF="reference/$1.ref"
if ! rlAssertNotDiffer "$REF" "$OUT"; then
rlRun -l "diff -u \'$REF\' \'$OUT\'" 1
fi
rlRun "test ! -s \'$ERR\'" "0" "Check that stderr was empty"
}
PACKAGE="file"

View File

@ -4,12 +4,14 @@
compare() {
IN="db/$1"
OUT="$TMPDIR/out"
rlRun "file '$IN' > '$OUT'" "0" "Run file on $1"
ERR="$TMPDIR/err"
rlRun "file '$IN' > '$OUT' 2> '$ERR'" "0" "Run file on $1"
sed -i "s|^$IN: ||" "$OUT"
REF="reference/$1.ref"
if ! rlAssertNotDiffer "$REF" "$OUT"; then
rlRun -l "diff -u '$REF' '$OUT'" 1
fi
rlRun "test ! -s '$ERR'" "0" "Check that stderr was empty"
}
PACKAGE="file"