In order to fit the git coding style.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
# Generates a thread consisting of a top level message and 'length'
# replies. The subject of the top message 'subject: top message"
# and the subject of the nth reply in the thread is "subject: reply n"
# Generates a thread consisting of a top level message and 'length'
# replies. The subject of the top message 'subject: top message"
# and the subject of the nth reply in the thread is "subject: reply n"
local subject="$1"
local length="$2"
generate_message '[subject]="'"${subject}: top message"'"' '[body]="'"body of top message"'"'
local subject="$1"
local length="$2"
generate_message '[subject]="'"${subject}: top message"'"' '[body]="'"body of top message"'"'
cat <<EOF
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
"crypto": {},
cat <<EOF
[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",
"crypto": {},
# Sanity/smoke tests for the date/time parser independent of notmuch
# Sanity/smoke tests for the date/time parser independent of notmuch
${TEST_DIRECTORY}/parse-time --format=%s "$*"
}
${TEST_DIRECTORY}/parse-time --format=%s "$*"
}
export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
fi
export NOTMUCH_SRCDIR="$(cd "$(dirname "$0")"/.. && pwd)"
fi
local dir="$1"
while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do
local dir="$1"
while [[ -n "$dir" ]] && [[ "$dir" != "/" ]]; do
gen_msg_cnt=0
gen_msg_filename=""
gen_msg_id=""
gen_msg_cnt=0
gen_msg_filename=""
gen_msg_id=""
# This is our (bash-specific) magic for doing named parameters
local -A template="($@)"
local additional_headers
# This is our (bash-specific) magic for doing named parameters
local -A template="($@)"
local additional_headers
#
# All of the arguments and return values supported by generate_message
# are also supported here, so see that function for details.
#
# All of the arguments and return values supported by generate_message
# are also supported here, so see that function for details.
generate_message "$@" &&
notmuch new > /dev/null
}
generate_message "$@" &&
notmuch new > /dev/null
}
test_require_external_prereq dtach
}
test_require_external_prereq dtach
}
[ -e "${GNUPGHOME}/gpg.conf" ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
at_exit_function _gnupg_exit
[ -e "${GNUPGHOME}/gpg.conf" ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
at_exit_function _gnupg_exit
printf '%s:6:\n' "$FINGERPRINT" | gpg --quiet --batch --no-tty --import-ownertrust
}
printf '%s:6:\n' "$FINGERPRINT" | gpg --quiet --batch --no-tty --import-ownertrust
}
local fpr
[ -e "$GNUPGHOME/gpgsm.conf" ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
local fpr
[ -e "$GNUPGHOME/gpgsm.conf" ] && return
_gnupg_exit () { gpgconf --kill all 2>/dev/null || true; }
fi
test_description_printed=
fi
test_description_printed=
-print_test_description ()
-{
+print_test_description () {
test -z "$test_description_printed" || return 0
echo
echo $this_test: "Testing ${test_description}"
test -z "$test_description_printed" || return 0
echo
echo $this_test: "Testing ${test_description}"
# Accepts arbitrary extra emacs/elisp functions to modify the message
# before sending, which is useful to doing things like attaching files
# to the message and encrypting/signing.
# Accepts arbitrary extra emacs/elisp functions to modify the message
# before sending, which is useful to doing things like attaching files
# to the message and encrypting/signing.
-emacs_deliver_message ()
-{
+emacs_deliver_message () {
local subject body smtp_dummy_pid smtp_dummy_port
subject="$1"
body="$2"
local subject body smtp_dummy_pid smtp_dummy_port
subject="$1"
body="$2"
# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
# at the head of the argument list, they are sent directly to "notmuch
# new" after message delivery
# If any GNU-style long-arguments (like --quiet or --decrypt=true) are
# at the head of the argument list, they are sent directly to "notmuch
# new" after message delivery
local nmn_args subject body
nmn_args=''
while [[ "$1" =~ ^-- ]]; do
local nmn_args subject body
nmn_args=''
while [[ "$1" =~ ^-- ]]; do
# history of the notmuch mailing list, which allows for reliably
# testing commands that need to operate on a not-totally-trivial
# number of messages.
# history of the notmuch mailing list, which allows for reliably
# testing commands that need to operate on a not-totally-trivial
# number of messages.
local corpus
corpus=${1:-default}
local corpus
corpus=${1:-default}
notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
}
notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
}
-test_begin_subtest ()
-{
if [ -n "$inside_subtest" ]; then
exec 1>&6 2>&7 # Restore stdout and stderr
error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
if [ -n "$inside_subtest" ]; then
exec 1>&6 2>&7 # Restore stdout and stderr
error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
# not accept a test name. Instead, the caller should call
# test_begin_subtest before calling this function in order to set the
# name.
# not accept a test name. Instead, the caller should call
# test_begin_subtest before calling this function in order to set the
# name.
local output expected testname
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
local output expected testname
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
}
# Like test_expect_equal, but takes two filenames.
}
# Like test_expect_equal, but takes two filenames.
-test_expect_equal_file ()
-{
+test_expect_equal_file () {
local file1 file2 testname basename1 basename2
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
local file1 file2 testname basename1 basename2
exec 1>&6 2>&7 # Restore stdout and stderr
if [ -z "$inside_subtest" ]; then
notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
}
notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
}
# this relies on the default format being batch-tag, otherwise some tests will break
notmuch dump --include=tags "${@}" | sed '/^#/d' | sort
}
# this relies on the default format being batch-tag, otherwise some tests will break
notmuch dump --include=tags "${@}" | sed '/^#/d' | sort
}
-notmuch_drop_mail_headers ()
-{
+notmuch_drop_mail_headers () {
$NOTMUCH_PYTHON -c '
import email, sys
msg = email.message_from_file(sys.stdin)
$NOTMUCH_PYTHON -c '
import email, sys
msg = email.message_from_file(sys.stdin)
-notmuch_exception_sanitize ()
-{
+notmuch_exception_sanitize () {
perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/'
}
perl -pe 's/(A Xapian exception occurred at .*[.]cc?):([0-9]*)/\1:XXX/'
}
-notmuch_search_sanitize ()
-{
+notmuch_search_sanitize () {
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
}
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'
}
-notmuch_search_files_sanitize ()
-{
+notmuch_search_files_sanitize () {
-notmuch_dir_sanitize ()
-{
+notmuch_dir_sanitize () {
sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"
}
NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"
}
NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
-notmuch_show_sanitize ()
-{
+notmuch_show_sanitize () {
sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH"
}
sed -e "$NOTMUCH_SHOW_FILENAME_SQUELCH"
}
-notmuch_show_sanitize_all ()
-{
+notmuch_show_sanitize_all () {
sed \
-e 's| filename:.*| filename:XXXXX|' \
-e 's| id:[^ ]* | id:XXXXX |' | \
notmuch_date_sanitize
}
sed \
-e 's| filename:.*| filename:XXXXX|' \
-e 's| id:[^ ]* | id:XXXXX |' | \
notmuch_date_sanitize
}
-notmuch_json_show_sanitize ()
-{
+notmuch_json_show_sanitize () {
sed \
-e 's|"id": "[^"]*",|"id": "XXXXX",|g' \
-e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \
sed \
-e 's|"id": "[^"]*",|"id": "XXXXX",|g' \
-e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \
-e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
}
-e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g'
}
-notmuch_emacs_error_sanitize ()
-{
+notmuch_emacs_error_sanitize () {
local command
command=$1
shift
local command
command=$1
shift
-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
}
-e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"
}
-notmuch_date_sanitize ()
-{
+notmuch_date_sanitize () {
sed \
-e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/'
}
sed \
-e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/'
}
-notmuch_uuid_sanitize ()
-{
+notmuch_uuid_sanitize () {
sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'
}
sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'
}
-notmuch_built_with_sanitize ()
-{
+notmuch_built_with_sanitize () {
sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'
}
sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'
}
-notmuch_passwd_sanitize ()
-{
+notmuch_passwd_sanitize () {
${NOTMUCH_PYTHON} -c'
import os, sys, pwd, socket
${NOTMUCH_PYTHON} -c'
import os, sys, pwd, socket
-notmuch_config_sanitize ()
-{
+notmuch_config_sanitize () {
notmuch_dir_sanitize | notmuch_built_with_sanitize
}
notmuch_dir_sanitize | notmuch_built_with_sanitize
}
awk '/^\014part}/{ f=0 }; { if (f) { print $0 } } /^\014part{ ID: '"$1"'/{ f=1 }'
}
awk '/^\014part}/{ f=0 }; { if (f) { print $0 } } /^\014part{ ID: '"$1"'/{ f=1 }'
}