From 6ea13e779696e44f6fed5c154fbe3e70f80f5c7a Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 2 Dec 2012 17:29:00 +0200 Subject: [PATCH] Re: [patch v3 3/6] test/hex-escaping: new test for hex escaping routines --- 60/d653daf024932c5406f1b7a87d3a7c1901f796 | 163 ++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 60/d653daf024932c5406f1b7a87d3a7c1901f796 diff --git a/60/d653daf024932c5406f1b7a87d3a7c1901f796 b/60/d653daf024932c5406f1b7a87d3a7c1901f796 new file mode 100644 index 000000000..85a59dbe1 --- /dev/null +++ b/60/d653daf024932c5406f1b7a87d3a7c1901f796 @@ -0,0 +1,163 @@ +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 D3B98431FAF + for ; Sun, 2 Dec 2012 07:29:13 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +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 xLEX3OWwE1az for ; + Sun, 2 Dec 2012 07:29:09 -0800 (PST) +Received: from mail-la0-f53.google.com (mail-la0-f53.google.com + [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id BE941431FAE + for ; Sun, 2 Dec 2012 07:29:08 -0800 (PST) +Received: by mail-la0-f53.google.com with SMTP id w12so1686792lag.26 + for ; Sun, 02 Dec 2012 07:29:07 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type:x-gm-message-state; + bh=DIgSAf21MSIjKeg5qF9QapWw4gfKauUOCR09ohm0dWM=; + b=HHYs+usESMYNpelpJFD/IIsjBPJREXXFJKt9/Rt54Z2UnaBqbuFuKkAKEeaDYL4K3l + ivOe2ESNtWpq/voWhDq138pBEDNGaI3zA0aAOVym9YDtcmkjZH/FgZaxjDdr/UBlg4jf + rM57l4pPea1NMaexUUDG/6y+kEAYbSy76NFCLkt+8c4ETD4cUhA7WNsOjxIGdADUvs8n + mf4mzPh0FSTqkZQZzCjQ30uxxuV9xeAr3NJ5up57ebQSnn9VR7WedGy7srREnWynIgoG + 0jNVXv//Q8TFIn5wlODyvGWqGdvYNy7fQbTaH5DyGFNkBMN3T3vpy0uR19dh8oru97FD + Nfhg== +Received: by 10.112.84.102 with SMTP id x6mr3282820lby.35.1354462144399; + Sun, 02 Dec 2012 07:29:04 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id p9sm4239752lbc.3.2012.12.02.07.29.02 + (version=SSLv3 cipher=OTHER); Sun, 02 Dec 2012 07:29:03 -0800 (PST) +From: Jani Nikula +To: david@tethera.net, notmuch@notmuchmail.org +Subject: Re: [patch v3 3/6] test/hex-escaping: new test for hex escaping + routines +In-Reply-To: <1354455204-6908-4-git-send-email-david@tethera.net> +References: <1354455204-6908-1-git-send-email-david@tethera.net> + <1354455204-6908-4-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.14+124~g3b17402 (http://notmuchmail.org) Emacs/23.4.1 + (i686-pc-linux-gnu) +Date: Sun, 02 Dec 2012 17:29:00 +0200 +Message-ID: <87obiccw1v.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQkDmIOMhh7c6FCG8L/YeuMEQ9dcWiSBaEA6wQZd2c4sBpuYOttx0VRX3YG1ma2S/Y0l1r/Y +Cc: David Bremner +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: Sun, 02 Dec 2012 15:29:14 -0000 + +On Sun, 02 Dec 2012, david@tethera.net wrote: +> 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 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ +> test/notmuch-test | 1 + +> 2 files changed, 51 insertions(+) +> create mode 100755 test/hex-escaping +> +> diff --git a/test/hex-escaping b/test/hex-escaping +> new file mode 100755 +> index 0000000..3f107dd +> --- /dev/null +> +++ b/test/hex-escaping +> @@ -0,0 +1,50 @@ +> +#!/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 --in-place --direction=decode < EXPECTED.$test_count |\ + +Did you intend to use --in-place here? + +BR, +Jani. + +> + $TEST_DIRECTORY/hex-xcode --direction=encode > OUTPUT.$test_count +> +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count +> + +> +test_begin_subtest "round trip (in-place)" +> +find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED +> +$TEST_DIRECTORY/hex-xcode --in-place --direction=encode < EXPECTED |\ +> + $TEST_DIRECTORY/hex-xcode --in-place --direction=decode > OUTPUT +> +test_expect_equal_file OUTPUT EXPECTED +> + +> +test_begin_subtest "punctuation (in-place)" +> +tag1='comic_swear=$&^%$^%\\//-+$^%$' +> +tag_enc1=$($TEST_DIRECTORY/hex-xcode --in-place --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 (in-place)" +> +printf 'this\n tag\t has\n spaces\n' > EXPECTED.$test_count +> +$TEST_DIRECTORY/hex-xcode --in-place --direction=encode < EXPECTED.$test_count |\ +> + $TEST_DIRECTORY/hex-xcode --in-place --direction=decode > OUTPUT.$test_count +> +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count +> + +> +test_begin_subtest "round trip 8bit chars (in-place)" +> +echo '%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' > EXPECTED.$test_count +> +$TEST_DIRECTORY/hex-xcode --in-place --direction=decode < EXPECTED.$test_count |\ +> + $TEST_DIRECTORY/hex-xcode --in-place --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 f275439..a6ef34f 100755 +> --- a/test/notmuch-test +> +++ b/test/notmuch-test +> @@ -60,6 +60,7 @@ TESTS=" +> emacs-hello +> emacs-show +> missing-headers +> + hex-escaping +> parse-time-string +> search-date +> " +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2