From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CD6E642117A for ; Sat, 31 Mar 2012 15:18:11 -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 QeFaUpRRs43E for ; Sat, 31 Mar 2012 15:18:10 -0700 (PDT) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9684A421174 for ; Sat, 31 Mar 2012 15:17:54 -0700 (PDT) Received: by mail-bk0-f53.google.com with SMTP id j4so1547751bkw.26 for ; Sat, 31 Mar 2012 15:17:54 -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=0VUgop/NQnJbCyQT23WnTvpZolh8A9dH50xccoRxalY=; b=LoN+XUR0EYgSURgCHZL0cl0gnQWqVO/MRam0ex9rgbI9sfTg39LYF47M+tzbm2jjwz 8v/vgbk32R5sVjrf1DybLmrwW1fbuVckyC+h/TPTAoH9P2N1wI2aH1jC7qkSlQLZqGuS k5b2nNBB6JcCSZXwe2y96KCim8XW28BIBJ3lVQz6XdqXQL4FIryKV9C0eQMfWGZjBLjc Ed/ld1BXDdxSSoTBFwK5xCkznWBNOKSEekICNr8M1rW0JBhStlYzdvHQYV1Cuk9tSjou JUMEEUS7q485w2s6zhcOSwtzN1VE1Z94IW3Kyf50xuRoPguVPrsBPbke+3ZSBSjKPCam i1PA== Received: by 10.204.132.72 with SMTP id a8mr1341032bkt.42.1333232274154; Sat, 31 Mar 2012 15:17:54 -0700 (PDT) Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi. [84.248.80.253]) by mx.google.com with ESMTPS id r8sm8938570bki.2.2012.03.31.15.17.52 (version=SSLv3 cipher=OTHER); Sat, 31 Mar 2012 15:17:53 -0700 (PDT) From: Jani Nikula 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 Message-Id: X-Mailer: git-send-email 1.7.5.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQlOovDnYKfeihQkep4Whd0DQU9TvQ85GUunnCzyGtVucfKqg9AgwqV62lyDqKgvGe+XTza9 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, 31 Mar 2012 22:18:12 -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 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