Commit Diff


commit - ddd3c5529f58fc4dffe30c642ef1df7eee5ae2ec
commit + 475205fa0f2737475a17dd692b71611523b898a0
blob - 8408870b419129977d6dc71846a24b37ef80d19f
blob + e0a671a483eb2edcd7aacbdf777895e09dca4685
--- regress/Makefile
+++ regress/Makefile
@@ -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
blob - 41839d3197688da80313e59ffca16f8d16ee5125
blob + 5ad78ac7e447cc9e8c513bbddc2a03d3de4274ef
--- regress/tests.sh
+++ regress/tests.sh
@@ -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
-	fi
+=> ./..
+=> ./current%20date
+=> ./foo.gmi
+=> ./hello
+EOF
 
-	if [ "$body" -ne 5 ]; then
-		echo "expected five lines from the auto index, got $body"
-		return 1
+	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
+
+	return $ret
 }
 
 test_block() {