Print actual output on error

This commit is contained in:
southerntofu 2020-11-28 12:02:25 +01:00
parent 79c0f8e53d
commit efd4392eca
1 changed files with 14 additions and 2 deletions

View File

@ -32,6 +32,9 @@ function setup {
# Disable translations
export LANG="NONE"
# Enable debug for full log
export LOG="debug"
}
function teardown {
@ -67,22 +70,29 @@ error() {
@test "missing basedir" {
run $FORGEBUILD -b /tmp/THISPATHDOESNOTEXIST
echo "$output"
[ "$output" = "$(error missing_basedir)" ]
}
@test "unknown task" {
run $FORGEBUILD -b $FORGEBUILDDIR THISTASKDOESNOTEXIST
echo "$output"
[ "$output" = "$(error unknown_arg)" ]
}
@test "unknown argument" {
run $FORGEBUILD -WTF -b $FORGEBUILDDIR
[ "$output" = "$(error unknown_arg)" ]
echo "$output"
# First line is unknown_arg error, then maybe help message?
# But each implementation may have a different help so we don't
# check that precisely
[ "${lines[0]}" = "$(error unknown_arg)" ]
}
@test "clone failed" {
echo "/tmp/THISPATHDOESNOTEXIST" > $FORGEBUILDDIR/time.source
run $FORGEBUILD -b $FORGEBUILDDIR time
echo "$output"
[ "${lines[0]}" = "$(info config)" ]
[ "${lines[1]}" = "$(info process)" ]
[ "${lines[2]}" = "$(info clone)" ]
@ -91,6 +101,7 @@ error() {
@test "simple sourceless run" {
run $FORGEBUILD -b $FORGEBUILDDIR time
echo "$output"
[ "${lines[0]}" = "$(info config)" ]
[ "${lines[1]}" = "$(info process)" ]
[ "${lines[2]}" = "$(info run)" ]
@ -98,6 +109,7 @@ error() {
@test "no tasks requested" {
run $FORGEBUILD -b $FORGEBUILDDIR
echo "$output"
[ "${lines[0]}" = "$(info no_task)" ]
[ "${lines[1]}" = "$(info config)" ]
[ "${lines[2]}" = "$(info process)" ]
@ -109,7 +121,7 @@ error() {
@test "no tasks exist" {
rm -r $FORGEBUILDDIR/*
run $FORGEBUILD -b $FORGEBUILDDIR
echo $output
echo "$output"
[ "${lines[0]}" = "$(info no_task)" ]
[ "${lines[1]}" = "$(info config)" ]
# TODO: maybe introduce a "nothing to do" message here?