1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/bin/sh
# modelled after denemo/tests/unit.c
set -u
exec 2>&1
oneTimeSetUp() {
export GUILE_AUTO_COMPILE=0
export HOME=$AUTOPKGTEST_TMP
}
tearDown() {
echo
}
testRunAndQuit() {
denemo -n -e -a "(d-Quit)"
exit_code=$?
assertEquals 'Denemo should have exited with 0' 0 $exit_code
}
testSchemeLog() {
denemo -n -e --verbose -a '
(d-Debug "This is debug")
(d-Info "This is info")
(d-Message "This is message")
(d-Warning "This is warning")
(d-Critical "This is critical")
(d-Quit)' 2>&1
exit_code=$?
assertEquals 'Denemo should have exited with 0' 0 $exit_code
}
testSchemeLogError() {
denemo -n --fatal-scheme-errors \
-a '(d-Error "This error is fatal")(d-Quit)' 2>&1
exit_code=$?
assertNotEquals 'Denemo should have aborted with a non-zero exit code' \
0 $exit_code
}
testThumbnailer() {
thumbnail=$AUTOPKGTEST_TMP/thumbnail.png
scheme="(d-CreateThumbnail #f \"$thumbnail\")(d-Exit)"
input=tests/fixtures/denemo/blank.denemo
echo "Running scheme: $scheme $input"
denemo -n -e -V -a "$scheme" "$input" 2>&1
exit_code=$?
assertEquals 'Denemo should have exited with 0' 0 $exit_code
assertTrue "Thumbnail file $thumbnail should exist" '[ -r "$thumbnail" ]'
}
# load and run shUnit2
. shunit2
|