+ msggroup
+}
+
+testreturnstateequal() {
+ local STATE="$1"
+ if [ "$STATE" = 'testsuccesswithglobalerror' ]; then
+ local STATE="$2"
+ local TYPE="$3"
+ shift 3
+ msggroup "${STATE}equal"
+ if [ "$1" != '--nomsg' ]; then
+ local CMP="$1"
+ shift
+ testsuccesswithglobalerror "$STATE" "$TYPE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ else
+ local CMP="$2"
+ shift 2
+ testsuccesswithglobalerror "$STATE" "$TYPE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ fi
+ else
+ msggroup "${STATE}equal"
+ if [ "$2" != '--nomsg' ]; then
+ local CMP="$2"
+ shift 2
+ "$STATE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ else
+ local CMP="$3"
+ shift 3
+ "$STATE" --nomsg "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ fi
+ fi
+ msggroup
+}
+testsuccessequal() {
+ # we compare output, so we know perfectly well about N:
+ testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@"
+}
+testwarningequal() {
+ testreturnstateequal 'testwarning' "$@"
+}
+testfailureequal() {
+ testreturnstateequal 'testfailure' "$@"
+}
+
+testfailuremsg() {
+ msggroup 'testfailuremsg'
+ local CMP="$1"
+ shift
+ testfailure "$@"
+ msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings'
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile"
+ grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true
+ testoutputequal "$COMPAREFILE" echo "$CMP"
+ msggroup
+}
+testwarningmsg() {
+ msggroup 'testwarningmsg'
+ local CMP="$1"
+ shift
+ testwarning "$@"
+ msgtest 'Check that the output of the previous warned command has expected' 'warnings'
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile"
+ grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true
+ testoutputequal "$COMPAREFILE" echo "$CMP"
+ msggroup