From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 5/8] test/hex-escaping: new test for hex escaping routines
Date: Sun, 1 Apr 2012 01:17:25 +0300 [thread overview]
Message-ID: <bcea698f131fab27c7b835a7844590d3cafe7b75.1333231401.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1333231401.git.jani@nikula.org>
In-Reply-To: <cover.1333231401.git.jani@nikula.org>
From: David Bremner <bremner@debian.org>
These are more like unit tests, to (try to) make sure the library
functionality is working before building more complicated things on
top of it.
---
test/hex-escaping | 26 ++++++++++++++++++++++++++
test/notmuch-test | 1 +
2 files changed, 27 insertions(+), 0 deletions(-)
create mode 100755 test/hex-escaping
diff --git a/test/hex-escaping b/test/hex-escaping
new file mode 100755
index 0000000..f34cc8c
--- /dev/null
+++ b/test/hex-escaping
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+test_description="hex encoding and decoding"
+. ./test-lib.sh
+
+test_begin_subtest "round trip"
+find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
+$TEST_DIRECTORY/hex-xcode --direction=encode < EXPECTED | $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "punctuation"
+tag1='comic_swear=$&^%$^%\\//-+$^%$'
+tag_enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1")
+test_expect_equal "$tag_enc1" "comic_swear=%24%26%5e%25%24%5e%25%5c%5c%2f%2f-+%24%5e%25%24"
+
+test_begin_subtest "round trip newlines"
+printf 'this\n tag\t has\n spaces\n' > EXPECTED.$test_count
+$TEST_DIRECTORY/hex-xcode --direction=encode < EXPECTED.$test_count |\
+ $TEST_DIRECTORY/hex-xcode --direction=decode > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
+test_begin_subtest "round trip 8bit chars"
+echo '%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' > EXPECTED.$test_count
+$TEST_DIRECTORY/hex-xcode --direction=decode < EXPECTED.$test_count |\
+ $TEST_DIRECTORY/hex-xcode --direction=encode > OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index f03b594..d667fbd 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -56,6 +56,7 @@ TESTS="
emacs-address-cleaning
emacs-hello
emacs-show
+ hex-escaping
"
TESTS=${NOTMUCH_TESTS:=$TESTS}
--
1.7.5.4
next prev parent reply other threads:[~2012-03-31 22:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 22:17 [PATCH 0/8] batch tagging support: "notmuch tag --stdin" Jani Nikula
2012-03-31 22:17 ` [PATCH 1/8] hex-escape: (en|de)code strings to/from restricted character set Jani Nikula
2012-03-31 22:17 ` [PATCH 2/8] hex-escape: be more strict about the format while decoding Jani Nikula
2012-04-05 11:33 ` David Bremner
2012-04-05 11:49 ` Jani Nikula
2012-04-05 11:59 ` David Bremner
2012-03-31 22:17 ` [PATCH 3/8] hex-escape: add function to decode escaped string in-place Jani Nikula
2012-04-05 11:56 ` David Bremner
2012-04-05 12:00 ` Jani Nikula
2012-03-31 22:17 ` [PATCH 4/8] test/hex-xcode: new test binary Jani Nikula
2012-03-31 22:17 ` Jani Nikula [this message]
2012-03-31 22:17 ` [PATCH 6/8] cli: add support for batch tagging operations to "notmuch tag" Jani Nikula
2012-04-02 17:51 ` Jameson Graef Rollins
2012-04-02 19:46 ` Jani Nikula
2012-04-02 17:54 ` Jameson Graef Rollins
2012-04-02 20:26 ` David Bremner
2012-04-02 20:42 ` Jameson Graef Rollins
2012-04-02 21:07 ` Jani Nikula
2012-04-02 21:20 ` Jameson Graef Rollins
2012-04-02 21:31 ` Jani Nikula
2012-04-02 21:43 ` Jameson Graef Rollins
2012-04-03 8:21 ` Jani Nikula
2012-04-03 22:51 ` Jameson Graef Rollins
2012-04-04 2:09 ` David Bremner
2012-04-04 7:55 ` Jameson Graef Rollins
2012-04-04 10:55 ` David Bremner
2012-03-31 22:17 ` [PATCH 7/8] test: add test for notmuch tag --stdin option Jani Nikula
2012-03-31 22:17 ` [PATCH 8/8] man: document " Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bcea698f131fab27c7b835a7844590d3cafe7b75.1333231401.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).