[RFC PATCH] test: add devel/test-in-docker.sh
[notmuch-archives.git] / cb / aa895d31871eba268dc9be5899728506a0b2f4
1 Return-Path: <bremner@tesseract.cs.unb.ca>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 01668431FB6\r
6         for <notmuch@notmuchmail.org>; Tue, 14 Aug 2012 02:04:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id GNWnyOEk0RBp for <notmuch@notmuchmail.org>;\r
16         Tue, 14 Aug 2012 02:04:07 -0700 (PDT)\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
18         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 29D5D431FAE\r
21         for <notmuch@notmuchmail.org>; Tue, 14 Aug 2012 02:04:07 -0700 (PDT)\r
22 Received: from remotemail by tesseract.cs.unb.ca with local (Exim 4.72)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1T1D2k-00063m-Lz; Tue, 14 Aug 2012 06:04:06 -0300\r
25 Received: (nullmailer pid 5276 invoked by uid 1000);\r
26         Mon, 13 Aug 2012 20:14:06 -0000\r
27 From: David Bremner <bremner@debian.org>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v2 3/6] test/hex-escaping: new test for hex escaping routines\r
30 Date: Mon, 13 Aug 2012 22:13:48 +0200\r
31 Message-Id: <1344888831-4301-4-git-send-email-bremner@debian.org>\r
32 X-Mailer: git-send-email 1.7.10.4\r
33 In-Reply-To: <1344888831-4301-1-git-send-email-bremner@debian.org>\r
34 References: <1344888831-4301-1-git-send-email-bremner@debian.org>\r
35 Cc: David Bremner <bremner@debian.org>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Tue, 14 Aug 2012 09:04:08 -0000\r
49 \r
50 These are more like unit tests, to (try to) make sure the library\r
51 functionality is working before building more complicated things on\r
52 top of it.\r
53 ---\r
54  test/hex-escaping |   26 ++++++++++++++++++++++++++\r
55  test/notmuch-test |    1 +\r
56  2 files changed, 27 insertions(+)\r
57  create mode 100755 test/hex-escaping\r
58 \r
59 diff --git a/test/hex-escaping b/test/hex-escaping\r
60 new file mode 100755\r
61 index 0000000..f34cc8c\r
62 --- /dev/null\r
63 +++ b/test/hex-escaping\r
64 @@ -0,0 +1,26 @@\r
65 +#!/usr/bin/env bash\r
66 +test_description="hex encoding and decoding"\r
67 +. ./test-lib.sh\r
68 +\r
69 +test_begin_subtest "round trip"\r
70 +find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED\r
71 +$TEST_DIRECTORY/hex-xcode --direction=encode < EXPECTED | $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT\r
72 +test_expect_equal_file OUTPUT EXPECTED\r
73 +\r
74 +test_begin_subtest "punctuation"\r
75 +tag1='comic_swear=$&^%$^%\\//-+$^%$'\r
76 +tag_enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1")\r
77 +test_expect_equal "$tag_enc1" "comic_swear=%24%26%5e%25%24%5e%25%5c%5c%2f%2f-+%24%5e%25%24"\r
78 +\r
79 +test_begin_subtest "round trip newlines"\r
80 +printf 'this\n tag\t has\n spaces\n' > EXPECTED.$test_count\r
81 +$TEST_DIRECTORY/hex-xcode --direction=encode  < EXPECTED.$test_count |\\r
82 +       $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT.$test_count\r
83 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
84 +\r
85 +test_begin_subtest "round trip 8bit chars"\r
86 +echo '%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' > EXPECTED.$test_count\r
87 +$TEST_DIRECTORY/hex-xcode --direction=decode  < EXPECTED.$test_count |\\r
88 +       $TEST_DIRECTORY/hex-xcode --direction=encode > OUTPUT.$test_count\r
89 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count\r
90 +test_done\r
91 diff --git a/test/notmuch-test b/test/notmuch-test\r
92 index cc732c3..43b5734 100755\r
93 --- a/test/notmuch-test\r
94 +++ b/test/notmuch-test\r
95 @@ -60,6 +60,7 @@ TESTS="\r
96    emacs-hello\r
97    emacs-show\r
98    missing-headers\r
99 +  hex-escaping\r
100  "\r
101  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
102  \r
103 -- \r
104 1.7.10.4\r
105 \r