1 Return-Path: <bremner@tethera.net>
\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 3C488431FBF
\r
6 for <notmuch@notmuchmail.org>; Sun, 2 Dec 2012 05:34:05 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 RXgUZgZXh001 for <notmuch@notmuchmail.org>;
\r
16 Sun, 2 Dec 2012 05:34:01 -0800 (PST)
\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 D3735431FD0
\r
21 for <notmuch@notmuchmail.org>; Sun, 2 Dec 2012 05:33:50 -0800 (PST)
\r
22 Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([142.167.90.129] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>)
\r
27 id 1Tf9g0-0005w2-KT; Sun, 02 Dec 2012 09:33:50 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1Tf9fv-0001rV-5S; Sun, 02 Dec 2012 09:33:39 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [patch v3 3/6] test/hex-escaping: new test for hex escaping routines
\r
34 Date: Sun, 2 Dec 2012 09:33:21 -0400
\r
35 Message-Id: <1354455204-6908-4-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.10.4
\r
37 In-Reply-To: <1354455204-6908-1-git-send-email-david@tethera.net>
\r
38 References: <1354455204-6908-1-git-send-email-david@tethera.net>
\r
40 Cc: David Bremner <bremner@debian.org>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Sun, 02 Dec 2012 13:34:05 -0000
\r
55 From: David Bremner <bremner@debian.org>
\r
57 These are more like unit tests, to (try to) make sure the library
\r
58 functionality is working before building more complicated things on
\r
61 test/hex-escaping | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
62 test/notmuch-test | 1 +
\r
63 2 files changed, 51 insertions(+)
\r
64 create mode 100755 test/hex-escaping
\r
66 diff --git a/test/hex-escaping b/test/hex-escaping
\r
67 new file mode 100755
\r
68 index 0000000..3f107dd
\r
70 +++ b/test/hex-escaping
\r
72 +#!/usr/bin/env bash
\r
73 +test_description="hex encoding and decoding"
\r
76 +test_begin_subtest "round trip"
\r
77 +find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
\r
78 +$TEST_DIRECTORY/hex-xcode --direction=encode < EXPECTED | $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT
\r
79 +test_expect_equal_file OUTPUT EXPECTED
\r
81 +test_begin_subtest "punctuation"
\r
82 +tag1='comic_swear=$&^%$^%\\//-+$^%$'
\r
83 +tag_enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1")
\r
84 +test_expect_equal "$tag_enc1" "comic_swear=%24%26%5e%25%24%5e%25%5c%5c%2f%2f-+%24%5e%25%24"
\r
86 +test_begin_subtest "round trip newlines"
\r
87 +printf 'this\n tag\t has\n spaces\n' > EXPECTED.$test_count
\r
88 +$TEST_DIRECTORY/hex-xcode --direction=encode < EXPECTED.$test_count |\
\r
89 + $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT.$test_count
\r
90 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
92 +test_begin_subtest "round trip 8bit chars"
\r
93 +echo '%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' > EXPECTED.$test_count
\r
94 +$TEST_DIRECTORY/hex-xcode --in-place --direction=decode < EXPECTED.$test_count |\
\r
95 + $TEST_DIRECTORY/hex-xcode --direction=encode > OUTPUT.$test_count
\r
96 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
98 +test_begin_subtest "round trip (in-place)"
\r
99 +find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
\r
100 +$TEST_DIRECTORY/hex-xcode --in-place --direction=encode < EXPECTED |\
\r
101 + $TEST_DIRECTORY/hex-xcode --in-place --direction=decode > OUTPUT
\r
102 +test_expect_equal_file OUTPUT EXPECTED
\r
104 +test_begin_subtest "punctuation (in-place)"
\r
105 +tag1='comic_swear=$&^%$^%\\//-+$^%$'
\r
106 +tag_enc1=$($TEST_DIRECTORY/hex-xcode --in-place --direction=encode "$tag1")
\r
107 +test_expect_equal "$tag_enc1" "comic_swear=%24%26%5e%25%24%5e%25%5c%5c%2f%2f-+%24%5e%25%24"
\r
109 +test_begin_subtest "round trip newlines (in-place)"
\r
110 +printf 'this\n tag\t has\n spaces\n' > EXPECTED.$test_count
\r
111 +$TEST_DIRECTORY/hex-xcode --in-place --direction=encode < EXPECTED.$test_count |\
\r
112 + $TEST_DIRECTORY/hex-xcode --in-place --direction=decode > OUTPUT.$test_count
\r
113 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
115 +test_begin_subtest "round trip 8bit chars (in-place)"
\r
116 +echo '%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' > EXPECTED.$test_count
\r
117 +$TEST_DIRECTORY/hex-xcode --in-place --direction=decode < EXPECTED.$test_count |\
\r
118 + $TEST_DIRECTORY/hex-xcode --in-place --direction=encode > OUTPUT.$test_count
\r
119 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
122 diff --git a/test/notmuch-test b/test/notmuch-test
\r
123 index f275439..a6ef34f 100755
\r
124 --- a/test/notmuch-test
\r
125 +++ b/test/notmuch-test
\r
126 @@ -60,6 +60,7 @@ TESTS="
\r