[PATCH v7 01/10] test: Add broken test for the new JSON reply format.
Quoth Adam Wolfe Gordon on Mar 11 at 10:05 pm: > --- > test/multipart | 53 +++ > test/test-lib | 1242 > > 2 files changed, 1295 insertions(+), 0 deletions(-) > create mode 100755 test/test-lib > > diff --git a/test/multipart b/test/multipart > index 53782c6..80d6e88 100755 > --- a/test/multipart > +++ b/test/multipart > @@ -589,6 +589,59 @@ Non-text part: text/html > EOF > test_expect_equal_file OUTPUT EXPECTED > > +test_begin_subtest "'notmuch reply' to a multipart message with json format" > +test_subtest_known_broken > +notmuch reply --format=json 'id:87liy5ap00.fsf at yoom.home.cworth.org' | > notmuch_json_show_sanitize >OUTPUT > +cat+{"reply-headers": {"Subject": "Re: Multipart message", > + "From": "Notmuch Test Suite ", > + "To": "Carl Worth , > + cworth at cworth.org", > + "In-reply-to": "<87liy5ap00.fsf at yoom.home.cworth.org>", > + "References": " <87liy5ap00.fsf at yoom.home.cworth.org>"}, > + "original": {"id": "X", > + "match": false, > + "excluded": false, > + "filename": "Y", > + "timestamp": 978709437, > + "date_relative": "2001-01-05", > + "tags": ["attachment","inbox","signed","unread"], > + "headers": {"Subject": "Multipart message", > + "From": "Carl Worth ", > + "To": "cworth at cworth.org", > + "Date": "Fri, > + 05 Jan 2001 15:43:57 +"}, > + "body": [{"id": 1, > + "content-type": "multipart/signed", > + "content": [{"id": 2, > + "content-type": "multipart/mixed", > + "content": [{"id": 3, > + "content-type": "message/rfc822", > + "content": [{"headers": {"Subject": "html message", > + "From": "Carl Worth ", > + "To": "cworth at cworth.org", > + "Date": "Fri, > + 05 Jan 2001 15:42:57 +"}, > + "body": [{"id": 4, > + "content-type": "multipart/alternative", > + "content": [{"id": 5, > + "content-type": "text/html"}, > + {"id": 6, > + "content-type": "text/plain", > + "content": "This is an embedded message, > + with a multipart/alternative part.\n"}]}]}]}, > + {"id": 7, > + "content-type": "text/plain", > + "filename": "Y", > + "content": "This is a text attachment.\n"}, > + {"id": 8, > + "content-type": "text/plain", > + "content": "And this message is signed.\n\n-Carl\n"}]}, > + {"id": 9, > + "content-type": "application/pgp-signature"}]}]}} > +EOF > +test_expect_equal_file OUTPUT EXPECTED > + > test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF > pair" > notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out > echo -n -e "\xEF\x0D\x0A" > crlf.expected > diff --git a/test/test-lib b/test/test-lib > new file mode 100755 > index 000..8158328 > --- /dev/null > +++ b/test/test-lib Spurious git add? (IIRC, this is what test-lib.sh used to be called, so I'd guess you have an old copy of this file laying around.) > @@ -0,0 +1,1242 @@ > +# > +# Copyright (c) 2005 Junio C Hamano > +# > +# This program is free software: you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation, either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see http://www.gnu.org/licenses/ . > + > +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then > +echo "Error: The notmuch test suite requires a bash version >= 4.0" > +echo "due to use of associative arrays within the test suite." > +echo "Please try again with a newer bash (or help us fix the" > +echo "test suite to be more portable). Thanks." > +exit 1 > +fi > + > +# if --tee was passed, write the output not only to the terminal, but > +# additionally to the file test-results/$BASENAME.out, too. > +case "$GIT_TEST_TEE_STARTED, $* " in > +done,*) > + # do not redirect again > + ;; > +*' --tee '*|*' --va'*) > + mkdir -p test-results > + BASE=test-results/$(basename "$0" .sh) > + (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1; > + echo $? > $BASE.exit) | tee $BASE.out > + test "$(cat $BASE.exit)" = 0 > + exit > + ;; > +esac > + > +# Keep the original TERM for say_color and test_emacs > +ORIGINAL_TERM=$TERM > + > +# For repeatability, reset the environment to known value. > +LANG=C > +LC_ALL=C > +PAGER=cat > +TZ=UTC > +TERM=dumb > +export LANG LC_ALL PAGER TERM TZ > +GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} > +TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} > + > +# Protect ourselves from common misconfiguration to export > +# CDPATH into the environment > +unset CDPATH > + > +unset GREP_OPTIONS > + > +# Convenience > +# > +# A regexp to match 5 and 40 hexdigits > +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a
[PATCH v7 01/10] test: Add broken test for the new JSON reply format.
On Tue, Mar 13, 2012 at 10:49, Austin Clements wrote: >> diff --git a/test/test-lib b/test/test-lib >> new file mode 100755 >> index 000..8158328 >> --- /dev/null >> +++ b/test/test-lib > > Spurious git add? ?(IIRC, this is what test-lib.sh used to be called, > so I'd guess you have an old copy of this file laying around.) Yep, looks like it. I wonder how I missed that.
Re: [PATCH v7 01/10] test: Add broken test for the new JSON reply format.
On Tue, Mar 13, 2012 at 10:49, Austin Clements wrote: >> diff --git a/test/test-lib b/test/test-lib >> new file mode 100755 >> index 000..8158328 >> --- /dev/null >> +++ b/test/test-lib > > Spurious git add? (IIRC, this is what test-lib.sh used to be called, > so I'd guess you have an old copy of this file laying around.) Yep, looks like it. I wonder how I missed that. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v7 01/10] test: Add broken test for the new JSON reply format.
Quoth Adam Wolfe Gordon on Mar 11 at 10:05 pm: > --- > test/multipart | 53 +++ > test/test-lib | 1242 > > 2 files changed, 1295 insertions(+), 0 deletions(-) > create mode 100755 test/test-lib > > diff --git a/test/multipart b/test/multipart > index 53782c6..80d6e88 100755 > --- a/test/multipart > +++ b/test/multipart > @@ -589,6 +589,59 @@ Non-text part: text/html > EOF > test_expect_equal_file OUTPUT EXPECTED > > +test_begin_subtest "'notmuch reply' to a multipart message with json format" > +test_subtest_known_broken > +notmuch reply --format=json 'id:87liy5ap00@yoom.home.cworth.org' | > notmuch_json_show_sanitize >OUTPUT > +cat+{"reply-headers": {"Subject": "Re: Multipart message", > + "From": "Notmuch Test Suite ", > + "To": "Carl Worth , > + cwo...@cworth.org", > + "In-reply-to": "<87liy5ap00@yoom.home.cworth.org>", > + "References": " <87liy5ap00@yoom.home.cworth.org>"}, > + "original": {"id": "X", > + "match": false, > + "excluded": false, > + "filename": "Y", > + "timestamp": 978709437, > + "date_relative": "2001-01-05", > + "tags": ["attachment","inbox","signed","unread"], > + "headers": {"Subject": "Multipart message", > + "From": "Carl Worth ", > + "To": "cwo...@cworth.org", > + "Date": "Fri, > + 05 Jan 2001 15:43:57 +"}, > + "body": [{"id": 1, > + "content-type": "multipart/signed", > + "content": [{"id": 2, > + "content-type": "multipart/mixed", > + "content": [{"id": 3, > + "content-type": "message/rfc822", > + "content": [{"headers": {"Subject": "html message", > + "From": "Carl Worth ", > + "To": "cwo...@cworth.org", > + "Date": "Fri, > + 05 Jan 2001 15:42:57 +"}, > + "body": [{"id": 4, > + "content-type": "multipart/alternative", > + "content": [{"id": 5, > + "content-type": "text/html"}, > + {"id": 6, > + "content-type": "text/plain", > + "content": "This is an embedded message, > + with a multipart/alternative part.\n"}]}]}]}, > + {"id": 7, > + "content-type": "text/plain", > + "filename": "Y", > + "content": "This is a text attachment.\n"}, > + {"id": 8, > + "content-type": "text/plain", > + "content": "And this message is signed.\n\n-Carl\n"}]}, > + {"id": 9, > + "content-type": "application/pgp-signature"}]}]}} > +EOF > +test_expect_equal_file OUTPUT EXPECTED > + > test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF > pair" > notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out > echo -n -e "\xEF\x0D\x0A" > crlf.expected > diff --git a/test/test-lib b/test/test-lib > new file mode 100755 > index 000..8158328 > --- /dev/null > +++ b/test/test-lib Spurious git add? (IIRC, this is what test-lib.sh used to be called, so I'd guess you have an old copy of this file laying around.) > @@ -0,0 +1,1242 @@ > +# > +# Copyright (c) 2005 Junio C Hamano > +# > +# This program is free software: you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation, either version 2 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see http://www.gnu.org/licenses/ . > + > +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then > +echo "Error: The notmuch test suite requires a bash version >= 4.0" > +echo "due to use of associative arrays within the test suite." > +echo "Please try again with a newer bash (or help us fix the" > +echo "test suite to be more portable). Thanks." > +exit 1 > +fi > + > +# if --tee was passed, write the output not only to the terminal, but > +# additionally to the file test-results/$BASENAME.out, too. > +case "$GIT_TEST_TEE_STARTED, $* " in > +done,*) > + # do not redirect again > + ;; > +*' --tee '*|*' --va'*) > + mkdir -p test-results > + BASE=test-results/$(basename "$0" .sh) > + (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1; > + echo $? > $BASE.exit) | tee $BASE.out > + test "$(cat $BASE.exit)" = 0 > + exit > + ;; > +esac > + > +# Keep the original TERM for say_color and test_emacs > +ORIGINAL_TERM=$TERM > + > +# For repeatability, reset the environment to known value. > +LANG=C > +LC_ALL=C > +PAGER=cat > +TZ=UTC > +TERM=dumb > +export LANG LC_ALL PAGER TERM TZ > +GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} > +TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} > + > +# Protect ourselves from common misconfiguration to export > +# CDPATH into the environment > +unset CDPATH > + > +unset GREP_OPTIONS > + > +# Convenience > +# > +# A regexp to match 5 and 40 hexdigits > +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' > +_x
[PATCH v7 01/10] test: Add broken test for the new JSON reply format.
--- test/multipart | 53 +++ test/test-lib | 1242 2 files changed, 1295 insertions(+), 0 deletions(-) create mode 100755 test/test-lib diff --git a/test/multipart b/test/multipart index 53782c6..80d6e88 100755 --- a/test/multipart +++ b/test/multipart @@ -589,6 +589,59 @@ Non-text part: text/html EOF test_expect_equal_file OUTPUT EXPECTED +test_begin_subtest "'notmuch reply' to a multipart message with json format" +test_subtest_known_broken +notmuch reply --format=json 'id:87liy5ap00.fsf at yoom.home.cworth.org' | notmuch_json_show_sanitize >OUTPUT +cat", + "References": " <87liy5ap00.fsf at yoom.home.cworth.org>"}, + "original": {"id": "X", + "match": false, + "excluded": false, + "filename": "Y", + "timestamp": 978709437, + "date_relative": "2001-01-05", + "tags": ["attachment","inbox","signed","unread"], + "headers": {"Subject": "Multipart message", + "From": "Carl Worth ", + "To": "cworth at cworth.org", + "Date": "Fri, + 05 Jan 2001 15:43:57 +"}, + "body": [{"id": 1, + "content-type": "multipart/signed", + "content": [{"id": 2, + "content-type": "multipart/mixed", + "content": [{"id": 3, + "content-type": "message/rfc822", + "content": [{"headers": {"Subject": "html message", + "From": "Carl Worth ", + "To": "cworth at cworth.org", + "Date": "Fri, + 05 Jan 2001 15:42:57 +"}, + "body": [{"id": 4, + "content-type": "multipart/alternative", + "content": [{"id": 5, + "content-type": "text/html"}, + {"id": 6, + "content-type": "text/plain", + "content": "This is an embedded message, + with a multipart/alternative part.\n"}]}]}]}, + {"id": 7, + "content-type": "text/plain", + "filename": "Y", + "content": "This is a text attachment.\n"}, + {"id": 8, + "content-type": "text/plain", + "content": "And this message is signed.\n\n-Carl\n"}]}, + {"id": 9, + "content-type": "application/pgp-signature"}]}]}} +EOF +test_expect_equal_file OUTPUT EXPECTED + test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF pair" notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out echo -n -e "\xEF\x0D\x0A" > crlf.expected diff --git a/test/test-lib b/test/test-lib new file mode 100755 index 000..8158328 --- /dev/null +++ b/test/test-lib @@ -0,0 +1,1242 @@ +# +# Copyright (c) 2005 Junio C Hamano +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . + +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then +echo "Error: The notmuch test suite requires a bash version >= 4.0" +echo "due to use of associative arrays within the test suite." +echo "Please try again with a newer bash (or help us fix the" +echo "test suite to be more portable). Thanks." +exit 1 +fi + +# if --tee was passed, write the output not only to the terminal, but +# additionally to the file test-results/$BASENAME.out, too. +case "$GIT_TEST_TEE_STARTED, $* " in +done,*) + # do not redirect again + ;; +*' --tee '*|*' --va'*) + mkdir -p test-results + BASE=test-results/$(basename "$0" .sh) + (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1; +echo $? > $BASE.exit) | tee $BASE.out + test "$(cat $BASE.exit)" = 0 + exit + ;; +esac + +# Keep the original TERM for say_color and test_emacs +ORIGINAL_TERM=$TERM + +# For repeatability, reset the environment to known value. +LANG=C +LC_ALL=C +PAGER=cat +TZ=UTC +TERM=dumb +export LANG LC_ALL PAGER TERM TZ +GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} +TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} + +# Protect ourselves from common misconfiguration to export +# CDPATH into the environment +unset CDPATH + +unset GREP_OPTIONS + +# Convenience +# +# A regexp to match 5 and 40 hexdigits +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05" + +_x04='[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04" + +# Each test should start with something like this, after copyright notices: +# +# test_description='Description of this test... +# This test checks if command xyzzy does the right thing... +# ' +# . ./test-lib.sh +[ "x$ORIGINAL_TERM" != "xdumb" ] && ( + TERM=$ORIGINAL_TERM && +
[PATCH v7 01/10] test: Add broken test for the new JSON reply format.
--- test/multipart | 53 +++ test/test-lib | 1242 2 files changed, 1295 insertions(+), 0 deletions(-) create mode 100755 test/test-lib diff --git a/test/multipart b/test/multipart index 53782c6..80d6e88 100755 --- a/test/multipart +++ b/test/multipart @@ -589,6 +589,59 @@ Non-text part: text/html EOF test_expect_equal_file OUTPUT EXPECTED +test_begin_subtest "'notmuch reply' to a multipart message with json format" +test_subtest_known_broken +notmuch reply --format=json 'id:87liy5ap00@yoom.home.cworth.org' | notmuch_json_show_sanitize >OUTPUT +cat", + "References": " <87liy5ap00@yoom.home.cworth.org>"}, + "original": {"id": "X", + "match": false, + "excluded": false, + "filename": "Y", + "timestamp": 978709437, + "date_relative": "2001-01-05", + "tags": ["attachment","inbox","signed","unread"], + "headers": {"Subject": "Multipart message", + "From": "Carl Worth ", + "To": "cwo...@cworth.org", + "Date": "Fri, + 05 Jan 2001 15:43:57 +"}, + "body": [{"id": 1, + "content-type": "multipart/signed", + "content": [{"id": 2, + "content-type": "multipart/mixed", + "content": [{"id": 3, + "content-type": "message/rfc822", + "content": [{"headers": {"Subject": "html message", + "From": "Carl Worth ", + "To": "cwo...@cworth.org", + "Date": "Fri, + 05 Jan 2001 15:42:57 +"}, + "body": [{"id": 4, + "content-type": "multipart/alternative", + "content": [{"id": 5, + "content-type": "text/html"}, + {"id": 6, + "content-type": "text/plain", + "content": "This is an embedded message, + with a multipart/alternative part.\n"}]}]}]}, + {"id": 7, + "content-type": "text/plain", + "filename": "Y", + "content": "This is a text attachment.\n"}, + {"id": 8, + "content-type": "text/plain", + "content": "And this message is signed.\n\n-Carl\n"}]}, + {"id": 9, + "content-type": "application/pgp-signature"}]}]}} +EOF +test_expect_equal_file OUTPUT EXPECTED + test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF pair" notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out echo -n -e "\xEF\x0D\x0A" > crlf.expected diff --git a/test/test-lib b/test/test-lib new file mode 100755 index 000..8158328 --- /dev/null +++ b/test/test-lib @@ -0,0 +1,1242 @@ +# +# Copyright (c) 2005 Junio C Hamano +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . + +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then +echo "Error: The notmuch test suite requires a bash version >= 4.0" +echo "due to use of associative arrays within the test suite." +echo "Please try again with a newer bash (or help us fix the" +echo "test suite to be more portable). Thanks." +exit 1 +fi + +# if --tee was passed, write the output not only to the terminal, but +# additionally to the file test-results/$BASENAME.out, too. +case "$GIT_TEST_TEE_STARTED, $* " in +done,*) + # do not redirect again + ;; +*' --tee '*|*' --va'*) + mkdir -p test-results + BASE=test-results/$(basename "$0" .sh) + (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1; +echo $? > $BASE.exit) | tee $BASE.out + test "$(cat $BASE.exit)" = 0 + exit + ;; +esac + +# Keep the original TERM for say_color and test_emacs +ORIGINAL_TERM=$TERM + +# For repeatability, reset the environment to known value. +LANG=C +LC_ALL=C +PAGER=cat +TZ=UTC +TERM=dumb +export LANG LC_ALL PAGER TERM TZ +GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} +TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} + +# Protect ourselves from common misconfiguration to export +# CDPATH into the environment +unset CDPATH + +unset GREP_OPTIONS + +# Convenience +# +# A regexp to match 5 and 40 hexdigits +_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05" + +_x04='[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04" + +# Each test should start with something like this, after copyright notices: +# +# test_description='Description of this test... +# This test checks if command xyzzy does the right thing... +# ' +# . ./test-lib.sh +[ "x$ORIGINAL_TERM" != "xdumb" ] && ( + TERM=$ORIGINAL_TERM && + exp