mirror of https://github.com/omar-polo/gmid.git
check for the expected page in test_auto_index
not just the number of lines, check the full page!
This commit is contained in:
parent
ddd3c5529f
commit
475205fa0f
|
@ -81,6 +81,7 @@ testdata: fill-file
|
|||
cp hello slow err invalid serve-bigfile env testdata/
|
||||
cp max-length-reply testdata
|
||||
mkdir testdata/dir
|
||||
date > 'testdata/dir/current date'
|
||||
cp hello testdata/dir
|
||||
cp testdata/index.gmi testdata/dir/foo.gmi
|
||||
touch testdata/test.m3u8 testdata/foo.1
|
||||
|
|
|
@ -171,20 +171,27 @@ test_auto_index() {
|
|||
check_reply "30 /dir/" || return 1
|
||||
|
||||
fetch_hdr /dir/
|
||||
check_reply "20 text/gemini"
|
||||
check_reply "20 text/gemini" || return 1
|
||||
|
||||
# we expect 5 lines from the auto index
|
||||
get /dir/ > listing || return 1
|
||||
cat <<EOF > listing.expected
|
||||
# Index of /dir/
|
||||
|
||||
body="$(get /dir/ | count)"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo 'failed to get /dir/'
|
||||
return 1
|
||||
=> ./..
|
||||
=> ./current%20date
|
||||
=> ./foo.gmi
|
||||
=> ./hello
|
||||
EOF
|
||||
|
||||
cmp -s listing.expected listing
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo 'unexpected dir content:'
|
||||
diff -u listing.expected listing
|
||||
fi
|
||||
rm listing listing.expected
|
||||
|
||||
if [ "$body" -ne 5 ]; then
|
||||
echo "expected five lines from the auto index, got $body"
|
||||
return 1
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
test_block() {
|
||||
|
|
Loading…
Reference in New Issue