Add test for empty sequence patch by c_14
[mmh] / test / tests / new / test-empty-seq
diff --git a/test/tests/new/test-empty-seq b/test/tests/new/test-empty-seq
new file mode 100644 (file)
index 0000000..f134f27
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# TODO: Move to a common file tests can source; need more framework...
+failed=0
+check() {
+    diff -u $expected $actual
+    if [ $? -ne 0 ]; then
+        failed=$((failed + 1))
+    fi
+}
+
+folders=$MH_TEST_DIR/Mail/.folders
+
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+# make second folder
+cp -r $MH_TEST_DIR/Mail/inbox $MH_TEST_DIR/Mail/foo1
+cp -r $MH_TEST_DIR/Mail/inbox $MH_TEST_DIR/Mail/foo2
+# but only list inbox and foo2 in .folders, and sorted differently
+cat > $folders <<EOF
+inbox
+foo2
+EOF
+
+# Add a sequence, which has no messages in it
+echo empty: >>"$MH_TEST_DIR/Mail/foo2/.mh_sequences"
+
+# test with the empty sequence
+cat > $expected <<EOF
+ total      0.
+EOF
+new empty > $actual 2>&1
+check
+new -folders $folders empty > $actual 2>&1
+check
+
+# test fnext/fprev with the empty sequence
+> $expected
+fnext empty > $actual 2>&1
+check
+fprev empty > $actual 2>&1
+check
+