bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
b7324e421e2132cbbf753e6fdbe675bbaecdf929Timo Sirainenstatic const struct {
c9099b08b3cae8a849098ca776b4363c6d5f5f36Timo Sirainen { "OR TEXT FOO ( ALL NOT ALL )", "TEXT FOO" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "( ( TEXT foo ) ( TEXT bar ) )", "TEXT foo TEXT bar" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT foo ) ( TEXT bar )", "OR TEXT foo TEXT bar" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "OR ( TEXT foo ) OR ( TEXT bar ) ( TEXT baz )",
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen "OR TEXT foo OR TEXT bar TEXT baz" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "OR ( ( TEXT foo TEXT foo2 ) ) ( ( TEXT bar ( TEXT baz ) ) )",
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen "OR (TEXT foo TEXT foo2) (TEXT bar TEXT baz)" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "NOT OR ( TEXT foo ) ( TEXT bar )", "NOT TEXT foo NOT TEXT bar" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "NOT ( OR ( TEXT foo ) ( TEXT bar ) )", "NOT TEXT foo NOT TEXT bar" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "NOT ( TEXT foo TEXT bar )", "OR NOT TEXT foo NOT TEXT bar" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "ANSWERED FLAGGED SEEN", "(ANSWERED FLAGGED SEEN)" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( ANSWERED FLAGGED SEEN ) DRAFT", "OR (ANSWERED FLAGGED SEEN) DRAFT" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen { "ANSWERED TEXT foo FLAGGED SEEN", "(ANSWERED FLAGGED SEEN) TEXT foo" },
fb79b36eb34532dbe67caf99eefe3660b8c841e0Timo Sirainen { "NOT ( ANSWERED FLAGGED SEEN )", "NOT (ANSWERED FLAGGED SEEN)" },
7000810786f2959f02cd6d2f4151a9eb61ff5db8Timo Sirainen { "OR NOT ANSWERED OR NOT FLAGGED NOT SEEN", "NOT (ANSWERED FLAGGED SEEN)" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR NOT ANSWERED OR NOT FLAGGED SEEN", "OR NOT (ANSWERED FLAGGED) SEEN" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR NOT ANSWERED OR FLAGGED NOT SEEN", "OR NOT (ANSWERED SEEN) FLAGGED" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "NOT ANSWERED OR FLAGGED NOT SEEN", "NOT ANSWERED OR FLAGGED NOT SEEN" },
47daf6e810a4c2dd52640092092900dbcb12f265Timo Sirainen { "NOT ANSWERED OR NOT FLAGGED NOT SEEN", "NOT ANSWERED NOT (FLAGGED SEEN)" },
92f5ea24e989266539e97c6fe59ede0565aec6fdTimo Sirainen { "ANSWERED NOT FLAGGED SEEN NOT DRAFT", "(ANSWERED SEEN) NOT FLAGGED NOT DRAFT" },
7000810786f2959f02cd6d2f4151a9eb61ff5db8Timo Sirainen { "OR NOT ANSWERED NOT SEEN", "NOT (ANSWERED SEEN)" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR NOT ANSWERED OR NOT SEEN TEXT foo", "OR NOT (ANSWERED SEEN) TEXT foo" },
cc23ad7b8ab96d93d5ab5139c431fcdd8d9e1d72Timo Sirainen { "ANSWERED ANSWERED NOT ANSWERED", "NOT ALL" },
cc23ad7b8ab96d93d5ab5139c431fcdd8d9e1d72Timo Sirainen { "ANSWERED NOT ANSWERED ANSWERED NOT ANSWERED", "NOT ALL" },
cc23ad7b8ab96d93d5ab5139c431fcdd8d9e1d72Timo Sirainen { "NOT ANSWERED NOT ANSWERED", "NOT ANSWERED" },
cc23ad7b8ab96d93d5ab5139c431fcdd8d9e1d72Timo Sirainen { "NOT SEEN NOT ANSWERED NOT ANSWERED", "NOT SEEN NOT ANSWERED" },
cc23ad7b8ab96d93d5ab5139c431fcdd8d9e1d72Timo Sirainen { "OR NOT SEEN OR NOT ANSWERED NOT ANSWERED", "NOT (ANSWERED SEEN)" },
1c0020171b04d14adc4966ed963361abc9a86787Timo Sirainen { "KEYWORD foo KEYWORD bar", "KEYWORD foo KEYWORD bar" },
1c0020171b04d14adc4966ed963361abc9a86787Timo Sirainen { "NOT KEYWORD foo NOT KEYWORD bar", "NOT KEYWORD foo NOT KEYWORD bar" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR KEYWORD foo KEYWORD bar", "OR KEYWORD foo KEYWORD bar" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR NOT KEYWORD foo NOT KEYWORD bar", "OR NOT KEYWORD foo NOT KEYWORD bar" },
1c0020171b04d14adc4966ed963361abc9a86787Timo Sirainen { "OR KEYWORD foo KEYWORD foo", "KEYWORD foo" },
1c0020171b04d14adc4966ed963361abc9a86787Timo Sirainen { "NOT KEYWORD foo NOT KEYWORD foo", "NOT KEYWORD foo" },
abb5d20d3155db02a1afec4066d52707ba9d4e52Timo Sirainen { "OR NOT 1:100 NOT 50:200", "1:49,101:4294967294" },
abb5d20d3155db02a1afec4066d52707ba9d4e52Timo Sirainen { "1:5 NOT UID 10:20", "1:5 UID 1:9,21:4294967294" },
abb5d20d3155db02a1afec4066d52707ba9d4e52Timo Sirainen { "ALL NOT UID 3:*", "NOT UID 3:4294967295" },
abb5d20d3155db02a1afec4066d52707ba9d4e52Timo Sirainen { "NOT 1:10 NOT *", "11:4294967294 NOT 4294967295" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "BEFORE 03-Aug-2014 BEFORE 01-Aug-2014 BEFORE 02-Aug-2014", "BEFORE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "OR BEFORE 01-Aug-2014 BEFORE 02-Aug-2014", "BEFORE \"02-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "OR BEFORE 01-Aug-2014 OR BEFORE 03-Aug-2014 BEFORE 02-Aug-2014", "BEFORE \"03-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "BEFORE 03-Aug-2014 NOT BEFORE 01-Aug-2014 BEFORE 02-Aug-2014", "BEFORE \"02-Aug-2014\" NOT BEFORE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SENTBEFORE 03-Aug-2014 SENTBEFORE 01-Aug-2014 SENTBEFORE 02-Aug-2014", "SENTBEFORE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SENTBEFORE 03-Aug-2014 BEFORE 01-Aug-2014 SENTBEFORE 02-Aug-2014", "SENTBEFORE \"02-Aug-2014\" BEFORE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "ON 03-Aug-2014 ON 03-Aug-2014", "ON \"03-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "ON 03-Aug-2014 ON 04-Aug-2014", "ON \"03-Aug-2014\" ON \"04-Aug-2014\"" }, /* this could be replaced with e.g. NOT ALL */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ON 03-Aug-2014 ON 04-Aug-2014", "OR ON \"03-Aug-2014\" ON \"04-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SINCE 03-Aug-2014 SINCE 01-Aug-2014 SINCE 02-Aug-2014", "SINCE \"03-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "OR SINCE 01-Aug-2014 SINCE 02-Aug-2014", "SINCE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "OR SINCE 01-Aug-2014 OR SINCE 03-Aug-2014 SINCE 02-Aug-2014", "SINCE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SINCE 03-Aug-2014 NOT SINCE 01-Aug-2014 SINCE 02-Aug-2014", "SINCE \"03-Aug-2014\" NOT SINCE \"01-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SENTSINCE 03-Aug-2014 SENTSINCE 01-Aug-2014 SENTSINCE 02-Aug-2014", "SENTSINCE \"03-Aug-2014\"" },
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen { "SENTSINCE 03-Aug-2014 SINCE 01-Aug-2014 SENTSINCE 02-Aug-2014", "SENTSINCE \"03-Aug-2014\" SINCE \"01-Aug-2014\"" },
f5e8a76a128d4e92f0641135183c164fd5c5ce5eTimo Sirainen { "OR SMALLER 1 OR SMALLER 3 SMALLER 2", "SMALLER 3" },
f5e8a76a128d4e92f0641135183c164fd5c5ce5eTimo Sirainen { "SMALLER 3 NOT SMALLER 1 SMALLER 2", "SMALLER 2 NOT SMALLER 1" },
f5e8a76a128d4e92f0641135183c164fd5c5ce5eTimo Sirainen { "SMALLER 3 LARGER 5", "SMALLER 3 LARGER 5" }, /* this could be replaced with e.g. NOT ALL */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR SMALLER 3 LARGER 5", "OR SMALLER 3 LARGER 5" },
f5e8a76a128d4e92f0641135183c164fd5c5ce5eTimo Sirainen { "OR LARGER 1 OR LARGER 3 LARGER 2", "LARGER 1" },
cc935aff970ed6c24d136cc560c7e705a49d536cTimo Sirainen { "LARGER 3 NOT LARGER 1 LARGER 2", "LARGER 3 NOT LARGER 1" },
cc935aff970ed6c24d136cc560c7e705a49d536cTimo Sirainen { "SUBJECT foo SUBJECT foob", "SUBJECT foo SUBJECT foob" },
cc935aff970ed6c24d136cc560c7e705a49d536cTimo Sirainen { "OR SUBJECT foo SUBJECT foo", "SUBJECT foo" },
cc935aff970ed6c24d136cc560c7e705a49d536cTimo Sirainen { "TEXT foo TEXT foob", "TEXT foo TEXT foob" },
cc935aff970ed6c24d136cc560c7e705a49d536cTimo Sirainen { "OR ( TEXT foo OR TEXT foo TEXT foo ) ( TEXT foo ( TEXT foo ) )", "TEXT foo" },
279c6b6d0b0a159c8533102e7e914db21dadcb03Timo Sirainen /* value="" tests */
387f9e3b4120273ad0213206a0e9cc2dc0e62ccaTimo Sirainen /* OR: drop redundant args */
27e859cee42654bff801ba96677cfc4e4e0108c7Timo Sirainen { "OR ( TEXT common1 TEXT unique1 ) TEXT common1", "TEXT common1" },
27e859cee42654bff801ba96677cfc4e4e0108c7Timo Sirainen { "OR ( TEXT unique1 TEXT common1 ) TEXT common1", "TEXT common1" },
27e859cee42654bff801ba96677cfc4e4e0108c7Timo Sirainen { "OR TEXT common1 ( TEXT common1 TEXT unique1 )", "TEXT common1" },
27e859cee42654bff801ba96677cfc4e4e0108c7Timo Sirainen { "OR TEXT common1 ( TEXT unique1 TEXT common1 )", "TEXT common1" },
071543cc13df9600d2e97aa35f28907be5a79477Timo Sirainen { "OR ( TEXT common1 TEXT common2 ) ( TEXT common1 TEXT common2 TEXT unique1 )", "TEXT common1 TEXT common2" },
27e859cee42654bff801ba96677cfc4e4e0108c7Timo Sirainen { "OR TEXT common1 OR ( TEXT unique1 TEXT common1 ) ( TEXT unique3 TEXT common1 )", "TEXT common1" },
387f9e3b4120273ad0213206a0e9cc2dc0e62ccaTimo Sirainen /* OR: extract common AND */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT unique1 ) ( TEXT common1 TEXT unique2 )", "OR TEXT unique1 TEXT unique2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT unique1 TEXT common1 ) ( TEXT unique2 TEXT common1 )", "OR TEXT unique1 TEXT unique2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT unique1 ) ( TEXT unique2 TEXT common1 )", "OR TEXT unique1 TEXT unique2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT unique1 TEXT common1 ) ( TEXT common1 TEXT unique2 )", "OR TEXT unique1 TEXT unique2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT unique1 TEXT common1 ) ( TEXT common1 TEXT unique2 TEXT unique3 )", "OR TEXT unique1 (TEXT unique2 TEXT unique3) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT common2 TEXT unique1 ) ( TEXT common1 TEXT common2 TEXT unique2 )", "OR TEXT unique1 TEXT unique2 TEXT common2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT common2 TEXT unique1 TEXT unique2 ) ( TEXT common1 TEXT common2 TEXT unique3 TEXT unique4 )", "OR (TEXT unique1 TEXT unique2) (TEXT unique3 TEXT unique4) TEXT common2 TEXT common1" },
387f9e3b4120273ad0213206a0e9cc2dc0e62ccaTimo Sirainen /* non-matching cases */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT unique1 TEXT unique2 ) TEXT unique3", "OR (TEXT unique1 TEXT unique2) TEXT unique3" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT unique1 TEXT unique2 ) ( TEXT unique3 TEXT unique4 )", "OR (TEXT unique1 TEXT unique2) (TEXT unique3 TEXT unique4)" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT unique1 ) OR ( TEXT common1 TEXT unique2 ) TEXT unique3", "OR (TEXT common1 TEXT unique1) OR (TEXT common1 TEXT unique2) TEXT unique3" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 TEXT unique1 ) OR ( TEXT common1 TEXT common2 ) ( TEXT common2 TEXT unique2 )", "OR (TEXT common1 TEXT unique1) OR (TEXT common1 TEXT common2) (TEXT common2 TEXT unique2)" },
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen /* SUB: drop redundant args */
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen { "( OR TEXT common1 TEXT unique1 ) TEXT common1", "TEXT common1" },
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen { "( OR TEXT unique1 TEXT common1 ) TEXT common1", "TEXT common1" },
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen { "TEXT common1 ( OR TEXT common1 TEXT unique1 )", "TEXT common1" },
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen { "TEXT common1 ( OR TEXT unique1 TEXT common1 )", "TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 TEXT common2 ) ( OR TEXT common1 OR TEXT common2 TEXT unique1 )", "OR TEXT common1 TEXT common2" },
8d3af185ae454653fad60e41c5f36edb1d45c868Timo Sirainen { "TEXT common1 ( OR TEXT unique1 TEXT common1 ) ( OR TEXT unique3 TEXT common1 )", "TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "OR ( TEXT common1 ( OR TEXT unique1 TEXT common1 ) ) TEXT unique1", "OR TEXT common1 TEXT unique1" },
dea8bfa31729dbdde1b12718f1ef98fac4e99db9Timo Sirainen /* SUB: extract common OR */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 TEXT unique1 ) ( OR TEXT common1 TEXT unique2 )", "OR (TEXT unique1 TEXT unique2) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT unique1 TEXT common1 ) ( OR TEXT unique2 TEXT common1 )", "OR (TEXT unique1 TEXT unique2) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 TEXT unique1 ) ( OR TEXT unique2 TEXT common1 )", "OR (TEXT unique1 TEXT unique2) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT unique1 TEXT common1 ) ( OR TEXT common1 TEXT unique2 )", "OR (TEXT unique1 TEXT unique2) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT unique1 TEXT common1 ) ( OR TEXT common1 OR TEXT unique2 TEXT unique3 )", "OR (TEXT unique1 OR TEXT unique2 TEXT unique3) TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 OR TEXT common2 TEXT unique1 ) ( OR TEXT common1 OR TEXT common2 TEXT unique2 )", "OR (TEXT unique1 TEXT unique2) OR TEXT common2 TEXT common1" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 OR TEXT common2 OR TEXT unique1 TEXT unique2 ) ( OR TEXT common1 OR TEXT common2 OR TEXT unique3 TEXT unique4 )", "OR (OR TEXT unique1 TEXT unique2 OR TEXT unique3 TEXT unique4) OR TEXT common2 TEXT common1" },
dea8bfa31729dbdde1b12718f1ef98fac4e99db9Timo Sirainen /* non-matching cases */
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT unique1 TEXT unique2 ) TEXT unique3", "OR TEXT unique1 TEXT unique2 TEXT unique3" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT unique1 TEXT unique2 ) ( OR TEXT unique3 TEXT unique4 )", "OR TEXT unique1 TEXT unique2 OR TEXT unique3 TEXT unique4" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 TEXT unique1 ) ( OR TEXT common1 TEXT unique2 ) TEXT unique3", "OR TEXT common1 TEXT unique1 OR TEXT common1 TEXT unique2 TEXT unique3" },
5b2062e40f54535b212e800ffc79de0e405d4560Timo Sirainen { "( OR TEXT common1 TEXT unique1 ) ( OR TEXT common1 TEXT common2 ) ( OR TEXT common2 TEXT unique2 )", "OR TEXT common1 TEXT unique1 OR TEXT common1 TEXT common2 OR TEXT common2 TEXT unique2" },
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen parser = mail_search_parser_init_cmdline(t_strsplit(args, " "));
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen if (mail_search_build(mail_search_register_get_imap(),
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainenstatic bool test_search_args_are_initialized(struct mail_search_arg *arg)
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainen if (!test_search_args_are_initialized(arg->value.subargs))
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainenstatic void test_mail_search_args_simplify(void)
fccd110b494a7e31f23d31d9e3bc3e986c9bb1a8Timo Sirainen struct mail_storage_settings set = { .mail_max_keyword_length = 100 };
fccd110b494a7e31f23d31d9e3bc3e986c9bb1a8Timo Sirainen struct mail_storage storage = { .set = &set };
fccd110b494a7e31f23d31d9e3bc3e986c9bb1a8Timo Sirainen struct mailbox box = { .opened = TRUE, .storage = &storage };
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen unsigned int i;
82d158d37db5cfb4e26affe4bc2f2a235901d1b9Timo Sirainen box.index = mail_index_alloc(NULL, NULL, "dovecot.index.");
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen args = test_build_search_args(tests[i].input);
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainen /* delay simplification until after init. that way we can test
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainen that the simplification works correctly when working on
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainen already-initialized args. */
fccd110b494a7e31f23d31d9e3bc3e986c9bb1a8Timo Sirainen mail_search_args_init(args, &box, FALSE, NULL);
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen test_assert(mail_search_args_to_imap(str, args->args, &error));
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen test_assert_idx(strcmp(str_c(str), tests[i].output) == 0, i);
e5834cb5a1d79a886fe81648a1b8cc57f973dd1fTimo Sirainen test_assert_idx(test_search_args_are_initialized(args->args), i);
6de0cbb4a498ce0519b0f28e221164ce8d39736aTimo Sirainenstatic void test_mail_search_args_simplify_empty_lists(void)
6de0cbb4a498ce0519b0f28e221164ce8d39736aTimo Sirainen test_begin("mail search args simplify empty args");
baf3e87e186453fda13bd21f7cbcb2efc8492e8bTimo Sirainen static void (*const test_functions[])(void) = {