mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 05:34:11 +01:00
test: known broken tests for leading/trailing ws in config
These tests duplicate the bug/misfeature reported in id:CA+Tk8fzjPLaEd3vL1f9ebk_bF_RV8PDTLzDupraTkCLCpJAmCg@mail.gmail.com
This commit is contained in:
parent
eafb033d32
commit
e22bbb124e
3 changed files with 50 additions and 0 deletions
|
@ -329,6 +329,19 @@ notmuch config set new.tags "foo;;bar"
|
||||||
output=$(NOTMUCH_NEW --quiet 2>&1)
|
output=$(NOTMUCH_NEW --quiet 2>&1)
|
||||||
test_expect_equal "$output" ""
|
test_expect_equal "$output" ""
|
||||||
|
|
||||||
|
test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
|
||||||
|
test_subtest_known_broken
|
||||||
|
# avoid complications with leading spaces and "notmuch config"
|
||||||
|
sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
|
||||||
|
add_message
|
||||||
|
NOTMUCH_NEW --quiet
|
||||||
|
notmuch dump id:$gen_msg_id | sed 's/ --.*$//' > OUTPUT
|
||||||
|
cat <<EOF >EXPECTED
|
||||||
|
#notmuch-dump batch-tag:3 config,properties,tags
|
||||||
|
+bar +fu%20bar
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
|
test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
|
||||||
notmuch config set new.tags "-foo;bar"
|
notmuch config set new.tags "-foo;bar"
|
||||||
output=$(NOTMUCH_NEW --debug 2>&1)
|
output=$(NOTMUCH_NEW --debug 2>&1)
|
||||||
|
|
|
@ -234,6 +234,19 @@ output=$(notmuch show --format=json id:$gen_msg_id)
|
||||||
test_json_nodes <<<"$output" \
|
test_json_nodes <<<"$output" \
|
||||||
'new_tags:[0][0][0]["tags"] = ["bar", "foo"]'
|
'new_tags:[0][0][0]["tags"] = ["bar", "foo"]'
|
||||||
|
|
||||||
|
test_begin_subtest "leading/trailing whitespace in new.tags is ignored"
|
||||||
|
test_subtest_known_broken
|
||||||
|
# avoid complications with leading spaces and "notmuch config"
|
||||||
|
sed -i 's/^tags=.*$/tags= fu bar ; ; bar /' notmuch-config
|
||||||
|
gen_insert_msg
|
||||||
|
notmuch insert < $gen_msg_filename
|
||||||
|
notmuch dump id:$gen_msg_id | sed 's/ --.*$//' > OUTPUT
|
||||||
|
cat <<EOF >EXPECTED
|
||||||
|
#notmuch-dump batch-tag:3 config,properties,tags
|
||||||
|
+bar +fu%20bar
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
|
test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
|
||||||
notmuch config set new.tags "-foo;bar"
|
notmuch config set new.tags "-foo;bar"
|
||||||
gen_insert_msg
|
gen_insert_msg
|
||||||
|
|
|
@ -272,6 +272,30 @@ EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
restore_database
|
restore_database
|
||||||
|
|
||||||
|
test_begin_subtest "notmuch_config_get_values (ignore leading/trailing whitespace)"
|
||||||
|
test_subtest_known_broken
|
||||||
|
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
|
||||||
|
{
|
||||||
|
notmuch_config_values_t *values;
|
||||||
|
EXPECT0(notmuch_config_set (db, NOTMUCH_CONFIG_NEW_TAGS, " a ; b c ; d "));
|
||||||
|
for (values = notmuch_config_get_values (db, NOTMUCH_CONFIG_NEW_TAGS);
|
||||||
|
notmuch_config_values_valid (values);
|
||||||
|
notmuch_config_values_move_to_next (values))
|
||||||
|
{
|
||||||
|
puts (notmuch_config_values_get (values));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cat <<'EOF' >EXPECTED
|
||||||
|
== stdout ==
|
||||||
|
a
|
||||||
|
b c
|
||||||
|
d
|
||||||
|
== stderr ==
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
restore_database
|
||||||
|
|
||||||
test_begin_subtest "notmuch_config_get_values_string"
|
test_begin_subtest "notmuch_config_get_values_string"
|
||||||
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
|
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue