From: Jani Nikula Date: Sat, 14 Apr 2012 12:15:28 +0000 (+0300) Subject: [PATCH v2 3/6] test/hex-escaping: new test for hex escaping routines X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=0d3f148c916e1ebc28c100f6569585bd2ef529ea;p=notmuch-archives.git [PATCH v2 3/6] test/hex-escaping: new test for hex escaping routines --- diff --git a/0e/6380a73ae70cc19284d01169923a75cffba496 b/0e/6380a73ae70cc19284d01169923a75cffba496 new file mode 100644 index 000000000..c821c5315 --- /dev/null +++ b/0e/6380a73ae70cc19284d01169923a75cffba496 @@ -0,0 +1,126 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id C7E11431FBD + for ; Sat, 14 Apr 2012 05:15:50 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ZaS-mX9I-H1s for ; + Sat, 14 Apr 2012 05:15:49 -0700 (PDT) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B53C6431FC2 + for ; Sat, 14 Apr 2012 05:15:48 -0700 (PDT) +Received: by mail-lb0-f181.google.com with SMTP id b5so40243lbd.26 + for ; Sat, 14 Apr 2012 05:15:48 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references + :in-reply-to:references:x-gm-message-state; + bh=4icud2k3D9dexyaQHCKv2ry0mDdnP93vBKQ77LS0JVg=; + b=F346UZO+/GVKVDaSCDsoUpkwIN+D9Cfsu3q/lTV3lVqedVxv+t93ho4lqV9fHlSbJx + GIWseTCSLofSlO9lnGKXGaKb5I2rcKgRK3d7pn8Y7VlWSTPWZ60TZz853VDNdKHVAtRi + q+Ehxw3gkFMyzRXVAm4RnOUsabxud7u5Iwh+RauTbvhM0RVU+cGjZtV1sLOpWKQ9Kp43 + 2/t7poPRo5mJ2GtF3PT7CzaxRdufVxXCWjq5am8V0DeTPeaAP4qU7nYJ1CwN3WxVfaO2 + YzrKT8VZ7z5j1O/wAaRaRma8QU0aED4Q1kSo7tKaTsW+V4X/lcLI7qO1LyJK4914xuu6 + LYhw== +Received: by 10.112.24.103 with SMTP id t7mr2221927lbf.22.1334405748249; + Sat, 14 Apr 2012 05:15:48 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi. + [80.220.80.68]) + by mx.google.com with ESMTPS id oy17sm12644768lab.7.2012.04.14.05.15.46 + (version=SSLv3 cipher=OTHER); Sat, 14 Apr 2012 05:15:47 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2 3/6] test/hex-escaping: new test for hex escaping routines +Date: Sat, 14 Apr 2012 15:15:28 +0300 +Message-Id: + +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: +References: +In-Reply-To: +References: +X-Gm-Message-State: + ALoCoQnI/3Vp5b1a/wFxI/U0A3ygejPb0Q6BhfEhNnzCt2nmy4N3K9QWWTB/l746rQnHhtfFpPHw +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 14 Apr 2012 12:15:51 -0000 + +From: David Bremner + +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 801df73..2d0b381 100755 +--- a/test/notmuch-test ++++ b/test/notmuch-test +@@ -57,6 +57,7 @@ TESTS=" + emacs-address-cleaning + emacs-hello + emacs-show ++ hex-escaping + " + TESTS=${NOTMUCH_TESTS:=$TESTS} + +-- +1.7.5.4 +