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 1178F431FAF for ; Fri, 30 Nov 2012 13:59:36 -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 zWuFI4D6qiah for ; Fri, 30 Nov 2012 13:59:31 -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 EF348431FAE for ; Fri, 30 Nov 2012 13:59:30 -0800 (PST) Received: by mail-la0-f53.google.com with SMTP id w12so799167lag.26 for ; Fri, 30 Nov 2012 13:59:29 -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=C7klUEBgHJMuPxGWCmwVUBXmJtfDVirNMdsVZDAKAB4=; b=lOBdLFGYzdpJ1ICE2JEkCj6s27v7/Ar1yAignz6JsF7Bb8HPDIkFWX4NiKtno3JQNi Qdif41Jo8EIbiaGDHbGUqR5vy+ChP71hdH0TGAoecuSzVe20e5pnXmeqbCjjS8uZpOMd 5GgFLvE9/eanyIEnEliP9Lv30ES/CwyFfeFsBKE5DEB5zOmlhtYrw6lu+6ofryOwd8g6 21YqexXhqhOR8JYjydreZhMP4WmGoXKJTHJbAV89LHnlZ7sl0mULN3kYAQr1GMzoWVmq fbcas4K6XxCqFHsBwczU4zZQ8yWHQk95E5ZBUE11804WGyq0vGn2sAABFGZMbYmu1hyf MiGg== Received: by 10.112.13.140 with SMTP id h12mr1464105lbc.12.1354312769409; Fri, 30 Nov 2012 13:59:29 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id b4sm2533774lbi.0.2012.11.30.13.59.27 (version=SSLv3 cipher=OTHER); Fri, 30 Nov 2012 13:59:28 -0800 (PST) From: Jani Nikula To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [Patch v2 03/17] test/hex-escaping: new test for hex escaping routines In-Reply-To: <1353792017-31459-4-git-send-email-david@tethera.net> References: <1353792017-31459-1-git-send-email-david@tethera.net> <1353792017-31459-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: Fri, 30 Nov 2012 23:59:26 +0200 Message-ID: <87r4naiwg1.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQmvI+T/4ShnAZuUvcT9xzRwFnw/TqlBr68H+urWJ8DTgF1PJi54l+xmzoMSBqusgBowiYJP 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: Fri, 30 Nov 2012 21:59:36 -0000 On Sat, 24 Nov 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. LGTM. Here I observe that 'hex-xcode encode' and 'hex-xcode decode' might be a better fit than --direction. But this isn't of importance. BR, Jani. > --- > test/hex-escaping | 26 ++++++++++++++++++++++++++ > test/notmuch-test | 1 + > 2 files changed, 27 insertions(+) > 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 9a1b375..d2e90e2 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