+ test_begin_subtest "post-new with write access [${config}]"
+ rm -rf ${HOOK_DIR}
+ create_write_hook "post-new" write.expected write.output $HOOK_DIR
+ NOTMUCH_NEW
+ test_expect_equal_file write.expected write.output
+
+ test_begin_subtest "pre-new with write access [${config}]"
+ rm -rf ${HOOK_DIR}
+ create_write_hook "pre-new" write.expected write.output $HOOK_DIR
+ NOTMUCH_NEW
+ test_expect_equal_file write.expected write.output
+
+ test_begin_subtest "add message in pre-new [${config}]"
+ rm -rf ${HOOK_DIR}
+ generate_message '[subject]="add msg in pre-new"'
+ id1=$gen_msg_id
+ create_change_hook "pre-new" $gen_msg_filename $HOOK_DIR
+ generate_message '[subject]="add msg in new"'
+ NOTMUCH_NEW
+ notmuch search id:$id1 or id:$gen_msg_id | notmuch_search_sanitize > OUTPUT
+ cat <<EOF | sed s'/^[ \t]*//' > EXPECTED
+ thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; add msg in pre-new (inbox unread)
+ thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; add msg in new (inbox unread)
+EOF
+ test_expect_equal_file EXPECTED OUTPUT
+
+ test_begin_subtest "NOTMUCH_CONFIG is set"
+ create_printenv_hook "pre-new" NOTMUCH_CONFIG OUTPUT
+ NOTMUCH_NEW
+ cat <<EOF > EXPECTED
+${EXPECTED_CONFIG}
+EOF
+ test_expect_equal_file_nonempty EXPECTED OUTPUT
+
+ test_begin_subtest "NOTMUCH_CONFIG is set by --config"
+ create_printenv_hook "pre-new" NOTMUCH_CONFIG OUTPUT
+ cp "${EXPECTED_CONFIG}" "${EXPECTED_CONFIG}.alternate"
+ notmuch --config "${EXPECTED_CONFIG}.alternate" new
+ cat <<EOF > EXPECTED
+${EXPECTED_CONFIG}.alternate
+EOF
+ test_expect_equal_file_nonempty EXPECTED OUTPUT
+