]> rtime.felk.cvut.cz Git - notmuch.git/commitdiff
test: rearrange the test corpus into subfolders, fix tests
authorJani Nikula <jani@nikula.org>
Sun, 9 Mar 2014 12:25:37 +0000 (14:25 +0200)
committerDavid Bremner <david@tethera.net>
Tue, 11 Mar 2014 22:50:12 +0000 (19:50 -0300)
We will need this for improved folder search tests, but having some
folders should exercise our code paths better anyway.

Modify the relevant test accordingly to make it pass.

This reorganization triggers a bug in the test suite, namely that it
expects the output of --output=files to be in a certain order. So we
add the fix for that into the same commit.

This mainly involves sorting, although the case --duplicate=$n
requires more subtlety.

29 files changed:
test/T090-search-output.sh
test/corpus/01:2, [moved from test/corpus/cur/01:2, with 100% similarity]
test/corpus/02:2, [moved from test/corpus/cur/02:2, with 100% similarity]
test/corpus/bar/17:2, [moved from test/corpus/cur/17:2, with 100% similarity]
test/corpus/bar/18:2, [moved from test/corpus/cur/18:2, with 100% similarity]
test/corpus/bar/baz/05:2, [moved from test/corpus/cur/05:2, with 100% similarity]
test/corpus/bar/baz/23:2, [moved from test/corpus/cur/23:2, with 100% similarity]
test/corpus/bar/baz/24:2, [moved from test/corpus/cur/24:2, with 100% similarity]
test/corpus/bar/baz/cur/25:2, [moved from test/corpus/cur/25:2, with 100% similarity]
test/corpus/bar/baz/cur/26:2, [moved from test/corpus/cur/26:2, with 100% similarity]
test/corpus/bar/baz/new/27:2, [moved from test/corpus/cur/27:2, with 100% similarity]
test/corpus/bar/baz/new/28:2, [moved from test/corpus/cur/28:2, with 100% similarity]
test/corpus/bar/cur/19:2, [moved from test/corpus/cur/19:2, with 100% similarity]
test/corpus/bar/cur/20:2, [moved from test/corpus/cur/20:2, with 100% similarity]
test/corpus/bar/new/21:2, [moved from test/corpus/cur/21:2, with 100% similarity]
test/corpus/bar/new/22:2, [moved from test/corpus/cur/22:2, with 100% similarity]
test/corpus/foo/06:2, [moved from test/corpus/cur/06:2, with 100% similarity]
test/corpus/foo/baz/11:2, [moved from test/corpus/cur/11:2, with 100% similarity]
test/corpus/foo/baz/12:2, [moved from test/corpus/cur/12:2, with 100% similarity]
test/corpus/foo/baz/cur/13:2, [moved from test/corpus/cur/13:2, with 100% similarity]
test/corpus/foo/baz/cur/14:2, [moved from test/corpus/cur/14:2, with 100% similarity]
test/corpus/foo/baz/new/15:2, [moved from test/corpus/cur/15:2, with 100% similarity]
test/corpus/foo/baz/new/16:2, [moved from test/corpus/cur/16:2, with 100% similarity]
test/corpus/foo/cur/07:2, [moved from test/corpus/cur/07:2, with 100% similarity]
test/corpus/foo/cur/08:2, [moved from test/corpus/cur/08:2, with 100% similarity]
test/corpus/foo/new/03:2, [moved from test/corpus/cur/03:2, with 100% similarity]
test/corpus/foo/new/09:2, [moved from test/corpus/cur/09:2, with 100% similarity]
test/corpus/foo/new/10:2, [moved from test/corpus/cur/10:2, with 100% similarity]
test/corpus/new/04:2, [moved from test/corpus/cur/04:2, with 100% similarity]

index a8ab92058d6b7c3ba30f909ba62a7fb8a9fad9e9..947d572ebeff71418ae282868500f6b50f195f7b 100755 (executable)
@@ -181,67 +181,71 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "--output=files"
-notmuch search --output=files '*' | notmuch_search_files_sanitize >OUTPUT
+notmuch search --output=files '*' | notmuch_search_files_sanitize | sort >OUTPUT
 cat <<EOF >EXPECTED
-MAIL_DIR/cur/52:2,
-MAIL_DIR/cur/53:2,
-MAIL_DIR/cur/50:2,
-MAIL_DIR/cur/49:2,
-MAIL_DIR/cur/48:2,
-MAIL_DIR/cur/47:2,
-MAIL_DIR/cur/46:2,
-MAIL_DIR/cur/45:2,
-MAIL_DIR/cur/44:2,
-MAIL_DIR/cur/43:2,
-MAIL_DIR/cur/42:2,
-MAIL_DIR/cur/41:2,
-MAIL_DIR/cur/40:2,
-MAIL_DIR/cur/39:2,
-MAIL_DIR/cur/38:2,
-MAIL_DIR/cur/37:2,
-MAIL_DIR/cur/36:2,
-MAIL_DIR/cur/35:2,
-MAIL_DIR/cur/34:2,
-MAIL_DIR/cur/33:2,
-MAIL_DIR/cur/32:2,
-MAIL_DIR/cur/31:2,
-MAIL_DIR/cur/30:2,
+MAIL_DIR/01:2,
+MAIL_DIR/02:2,
+MAIL_DIR/bar/17:2,
+MAIL_DIR/bar/18:2,
+MAIL_DIR/bar/baz/05:2,
+MAIL_DIR/bar/baz/23:2,
+MAIL_DIR/bar/baz/24:2,
+MAIL_DIR/bar/baz/cur/25:2,
+MAIL_DIR/bar/baz/cur/26:2,
+MAIL_DIR/bar/baz/new/27:2,
+MAIL_DIR/bar/baz/new/28:2,
+MAIL_DIR/bar/cur/19:2,
+MAIL_DIR/bar/cur/20:2,
+MAIL_DIR/bar/new/21:2,
+MAIL_DIR/bar/new/22:2,
 MAIL_DIR/cur/29:2,
-MAIL_DIR/cur/28:2,
-MAIL_DIR/cur/27:2,
-MAIL_DIR/cur/26:2,
-MAIL_DIR/cur/25:2,
-MAIL_DIR/cur/24:2,
-MAIL_DIR/cur/23:2,
-MAIL_DIR/cur/22:2,
-MAIL_DIR/cur/21:2,
-MAIL_DIR/cur/19:2,
-MAIL_DIR/cur/18:2,
+MAIL_DIR/cur/30:2,
+MAIL_DIR/cur/31:2,
+MAIL_DIR/cur/32:2,
+MAIL_DIR/cur/33:2,
+MAIL_DIR/cur/34:2,
+MAIL_DIR/cur/35:2,
+MAIL_DIR/cur/36:2,
+MAIL_DIR/cur/37:2,
+MAIL_DIR/cur/38:2,
+MAIL_DIR/cur/39:2,
+MAIL_DIR/cur/40:2,
+MAIL_DIR/cur/41:2,
+MAIL_DIR/cur/42:2,
+MAIL_DIR/cur/43:2,
+MAIL_DIR/cur/44:2,
+MAIL_DIR/cur/45:2,
+MAIL_DIR/cur/46:2,
+MAIL_DIR/cur/47:2,
+MAIL_DIR/cur/48:2,
+MAIL_DIR/cur/49:2,
+MAIL_DIR/cur/50:2,
 MAIL_DIR/cur/51:2,
-MAIL_DIR/cur/20:2,
-MAIL_DIR/cur/17:2,
-MAIL_DIR/cur/16:2,
-MAIL_DIR/cur/15:2,
-MAIL_DIR/cur/14:2,
-MAIL_DIR/cur/13:2,
-MAIL_DIR/cur/12:2,
-MAIL_DIR/cur/11:2,
-MAIL_DIR/cur/10:2,
-MAIL_DIR/cur/09:2,
-MAIL_DIR/cur/08:2,
-MAIL_DIR/cur/06:2,
-MAIL_DIR/cur/05:2,
-MAIL_DIR/cur/04:2,
-MAIL_DIR/cur/03:2,
-MAIL_DIR/cur/07:2,
-MAIL_DIR/cur/02:2,
-MAIL_DIR/cur/01:2,
+MAIL_DIR/cur/52:2,
+MAIL_DIR/cur/53:2,
+MAIL_DIR/foo/06:2,
+MAIL_DIR/foo/baz/11:2,
+MAIL_DIR/foo/baz/12:2,
+MAIL_DIR/foo/baz/cur/13:2,
+MAIL_DIR/foo/baz/cur/14:2,
+MAIL_DIR/foo/baz/new/15:2,
+MAIL_DIR/foo/baz/new/16:2,
+MAIL_DIR/foo/cur/07:2,
+MAIL_DIR/foo/cur/08:2,
+MAIL_DIR/foo/new/03:2,
+MAIL_DIR/foo/new/09:2,
+MAIL_DIR/foo/new/10:2,
+MAIL_DIR/new/04:2,
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+dup1=$(notmuch search --output=files id:20091117232137.GA7669@griffis1.net | head -n 1 | sed -e "s,$MAIL_DIR,MAIL_DIR,")
+dup2=$(notmuch search --output=files id:20091117232137.GA7669@griffis1.net | tail -n 1 | sed -e "s,$MAIL_DIR,MAIL_DIR,")
+
 test_begin_subtest "--output=files --duplicate=1"
-notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize >OUTPUT
-cat <<EOF >EXPECTED
+notmuch search --output=files --duplicate=1 '*' | notmuch_search_files_sanitize | sort >OUTPUT
+cat <<EOF | sort >EXPECTED
+$dup1
 MAIL_DIR/cur/52:2,
 MAIL_DIR/cur/53:2,
 MAIL_DIR/cur/50:2,
@@ -266,40 +270,40 @@ MAIL_DIR/cur/32:2,
 MAIL_DIR/cur/31:2,
 MAIL_DIR/cur/30:2,
 MAIL_DIR/cur/29:2,
-MAIL_DIR/cur/28:2,
-MAIL_DIR/cur/27:2,
-MAIL_DIR/cur/26:2,
-MAIL_DIR/cur/25:2,
-MAIL_DIR/cur/24:2,
-MAIL_DIR/cur/23:2,
-MAIL_DIR/cur/22:2,
-MAIL_DIR/cur/21:2,
-MAIL_DIR/cur/19:2,
-MAIL_DIR/cur/18:2,
-MAIL_DIR/cur/20:2,
-MAIL_DIR/cur/17:2,
-MAIL_DIR/cur/16:2,
-MAIL_DIR/cur/15:2,
-MAIL_DIR/cur/14:2,
-MAIL_DIR/cur/13:2,
-MAIL_DIR/cur/12:2,
-MAIL_DIR/cur/11:2,
-MAIL_DIR/cur/10:2,
-MAIL_DIR/cur/09:2,
-MAIL_DIR/cur/08:2,
-MAIL_DIR/cur/06:2,
-MAIL_DIR/cur/05:2,
-MAIL_DIR/cur/04:2,
-MAIL_DIR/cur/03:2,
-MAIL_DIR/cur/07:2,
-MAIL_DIR/cur/02:2,
-MAIL_DIR/cur/01:2,
+MAIL_DIR/bar/baz/new/28:2,
+MAIL_DIR/bar/baz/new/27:2,
+MAIL_DIR/bar/baz/cur/26:2,
+MAIL_DIR/bar/baz/cur/25:2,
+MAIL_DIR/bar/baz/24:2,
+MAIL_DIR/bar/baz/23:2,
+MAIL_DIR/bar/new/22:2,
+MAIL_DIR/bar/new/21:2,
+MAIL_DIR/bar/cur/19:2,
+MAIL_DIR/bar/cur/20:2,
+MAIL_DIR/bar/17:2,
+MAIL_DIR/foo/baz/new/16:2,
+MAIL_DIR/foo/baz/new/15:2,
+MAIL_DIR/foo/baz/cur/14:2,
+MAIL_DIR/foo/baz/cur/13:2,
+MAIL_DIR/foo/baz/12:2,
+MAIL_DIR/foo/baz/11:2,
+MAIL_DIR/foo/new/10:2,
+MAIL_DIR/foo/new/09:2,
+MAIL_DIR/foo/cur/08:2,
+MAIL_DIR/foo/06:2,
+MAIL_DIR/bar/baz/05:2,
+MAIL_DIR/new/04:2,
+MAIL_DIR/foo/new/03:2,
+MAIL_DIR/foo/cur/07:2,
+MAIL_DIR/02:2,
+MAIL_DIR/01:2,
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "--output=files --format=json"
-notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize >OUTPUT
-cat <<EOF >EXPECTED
+notmuch search --format=json --output=files '*' | notmuch_search_files_sanitize \
+    | test_sort_json >OUTPUT
+cat <<EOF | test_sort_json >EXPECTED
 ["MAIL_DIR/cur/52:2,",
 "MAIL_DIR/cur/53:2,",
 "MAIL_DIR/cur/50:2,",
@@ -324,42 +328,42 @@ cat <<EOF >EXPECTED
 "MAIL_DIR/cur/31:2,",
 "MAIL_DIR/cur/30:2,",
 "MAIL_DIR/cur/29:2,",
-"MAIL_DIR/cur/28:2,",
-"MAIL_DIR/cur/27:2,",
-"MAIL_DIR/cur/26:2,",
-"MAIL_DIR/cur/25:2,",
-"MAIL_DIR/cur/24:2,",
-"MAIL_DIR/cur/23:2,",
-"MAIL_DIR/cur/22:2,",
-"MAIL_DIR/cur/21:2,",
-"MAIL_DIR/cur/19:2,",
-"MAIL_DIR/cur/18:2,",
+"MAIL_DIR/bar/baz/new/28:2,",
+"MAIL_DIR/bar/baz/new/27:2,",
+"MAIL_DIR/bar/baz/cur/26:2,",
+"MAIL_DIR/bar/baz/cur/25:2,",
+"MAIL_DIR/bar/baz/24:2,",
+"MAIL_DIR/bar/baz/23:2,",
+"MAIL_DIR/bar/new/22:2,",
+"MAIL_DIR/bar/new/21:2,",
+"MAIL_DIR/bar/cur/19:2,",
+"MAIL_DIR/bar/18:2,",
 "MAIL_DIR/cur/51:2,",
-"MAIL_DIR/cur/20:2,",
-"MAIL_DIR/cur/17:2,",
-"MAIL_DIR/cur/16:2,",
-"MAIL_DIR/cur/15:2,",
-"MAIL_DIR/cur/14:2,",
-"MAIL_DIR/cur/13:2,",
-"MAIL_DIR/cur/12:2,",
-"MAIL_DIR/cur/11:2,",
-"MAIL_DIR/cur/10:2,",
-"MAIL_DIR/cur/09:2,",
-"MAIL_DIR/cur/08:2,",
-"MAIL_DIR/cur/06:2,",
-"MAIL_DIR/cur/05:2,",
-"MAIL_DIR/cur/04:2,",
-"MAIL_DIR/cur/03:2,",
-"MAIL_DIR/cur/07:2,",
-"MAIL_DIR/cur/02:2,",
-"MAIL_DIR/cur/01:2,"]
+"MAIL_DIR/bar/cur/20:2,",
+"MAIL_DIR/bar/17:2,",
+"MAIL_DIR/foo/baz/new/16:2,",
+"MAIL_DIR/foo/baz/new/15:2,",
+"MAIL_DIR/foo/baz/cur/14:2,",
+"MAIL_DIR/foo/baz/cur/13:2,",
+"MAIL_DIR/foo/baz/12:2,",
+"MAIL_DIR/foo/baz/11:2,",
+"MAIL_DIR/foo/new/10:2,",
+"MAIL_DIR/foo/new/09:2,",
+"MAIL_DIR/foo/cur/08:2,",
+"MAIL_DIR/foo/06:2,",
+"MAIL_DIR/bar/baz/05:2,",
+"MAIL_DIR/new/04:2,",
+"MAIL_DIR/foo/new/03:2,",
+"MAIL_DIR/foo/cur/07:2,",
+"MAIL_DIR/02:2,",
+"MAIL_DIR/01:2,"]
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "--output=files --format=json --duplicate=2"
 notmuch search --format=json --output=files --duplicate=2 '*' | notmuch_search_files_sanitize >OUTPUT
 cat <<EOF >EXPECTED
-["MAIL_DIR/cur/51:2,"]
+["$dup2"]
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
similarity index 100%
rename from test/corpus/cur/01:2,
rename to test/corpus/01:2,
similarity index 100%
rename from test/corpus/cur/02:2,
rename to test/corpus/02:2,
similarity index 100%
rename from test/corpus/cur/17:2,
rename to test/corpus/bar/17:2,
similarity index 100%
rename from test/corpus/cur/18:2,
rename to test/corpus/bar/18:2,
similarity index 100%
rename from test/corpus/cur/06:2,
rename to test/corpus/foo/06:2,
similarity index 100%
rename from test/corpus/cur/04:2,
rename to test/corpus/new/04:2,