unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part
@ 2011-05-10  3:30 Dmitry Kurochkin
  2011-05-10  3:30 ` [PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them Dmitry Kurochkin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-05-10  3:30 UTC (permalink / raw)
  To: Notmuch Mail

This is amended patch from
id:"1304990689-10933-1-git-send-email-dmitry.kurochkin@gmail.com"
to test saving attachments withing Emacs using
notmuch-show-save-part.  It uses test_expect_equal_file instead
of test_expect_equal as suggested by Jameson.

This patch is for the release-candidate/0.6 branch.

Regards,
  Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them
  2011-05-10  3:30 [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
@ 2011-05-10  3:30 ` Dmitry Kurochkin
  2011-05-10  3:30 ` [PATCH 2/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
  2011-05-31 22:14 ` [PATCH v2 0/2] " Carl Worth
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-05-10  3:30 UTC (permalink / raw)
  To: Notmuch Mail

Before the change, test_expect_equal_file moved files it compared
in case of failure.  The patch changes it to copy the files
instead.  This allows testing non-temporary files which are
stored in git.

Note: the change should not result in new temporary files left
after the tests.  Test_expect_equal_file used to move files only
on failure, so callers had to cleanup them anyway.
---
 test/test-lib.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index eaf5051..7cc43cd 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -477,8 +477,8 @@ test_expect_equal_file ()
 			test_ok_ "$test_subtest_name"
 		else
 			testname=$this_test.$test_count
-			mv "$output" $testname.output
-			mv "$expected" $testname.expected
+			cp "$output" $testname.output
+			cp "$expected" $testname.expected
 			test_failure_ "$test_subtest_name" "$(diff -u $testname.expected $testname.output)"
 		fi
     fi
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] test: add test for saving attachments using notmuch-show-save-part
  2011-05-10  3:30 [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
  2011-05-10  3:30 ` [PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them Dmitry Kurochkin
@ 2011-05-10  3:30 ` Dmitry Kurochkin
  2011-05-31 22:14 ` [PATCH v2 0/2] " Carl Worth
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Kurochkin @ 2011-05-10  3:30 UTC (permalink / raw)
  To: Notmuch Mail

Use .gz filenames for saved attachments in the tests to check
that Emacs does not re-compress the file.

Use test_expect_equal_file instead of test_expect_equal to avoid
binary output on the console.
---
 test/emacs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/emacs b/test/emacs
index 75dec89..b376033 100755
--- a/test/emacs
+++ b/test/emacs
@@ -112,11 +112,15 @@ Fcc: $(pwd)/mail/sent
 On Fri, 29 Mar 1974 10:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
 > This is a test that messages are sent via SMTP"
 
-test_begin_subtest "Save attachment from within emacs"
-echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1
-output=$(cat attachment)
-expected=$(cat $EXPECTED/attachment)
-test_expect_equal "$output" "$expected"
+test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
+# save as archive to test that Emacs does not re-compress .gz
+echo ./attachment1.gz | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1
+test_expect_equal_file "$EXPECTED/attachment" attachment1.gz
+
+test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
+# save as archive to test that Emacs does not re-compress .gz
+echo ./attachment2.gz | test_emacs '(notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5)' > /dev/null 2>&1
+test_expect_equal_file "$EXPECTED/attachment" attachment2.gz
 
 test_begin_subtest "View raw message within emacs"
 expected=$(cat $EXPECTED/raw-message-cf0c4d-52ad0a)
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part
  2011-05-10  3:30 [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
  2011-05-10  3:30 ` [PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them Dmitry Kurochkin
  2011-05-10  3:30 ` [PATCH 2/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
@ 2011-05-31 22:14 ` Carl Worth
  2 siblings, 0 replies; 4+ messages in thread
From: Carl Worth @ 2011-05-31 22:14 UTC (permalink / raw)
  To: Dmitry Kurochkin, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

On Tue, 10 May 2011 07:30:49 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> This is amended patch from
> id:"1304990689-10933-1-git-send-email-dmitry.kurochkin@gmail.com"
> to test saving attachments withing Emacs using
> notmuch-show-save-part.  It uses test_expect_equal_file instead
> of test_expect_equal as suggested by Jameson.

Thanks, Dmitry.

I've now pushed these new tests, (along with the previous patch to fix
the bug being tested here).

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-31 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10  3:30 [PATCH v2 0/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
2011-05-10  3:30 ` [PATCH 1/2] test: copy files in test_expect_equal_file instead of moving them Dmitry Kurochkin
2011-05-10  3:30 ` [PATCH 2/2] test: add test for saving attachments using notmuch-show-save-part Dmitry Kurochkin
2011-05-31 22:14 ` [PATCH v2 0/2] " Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).