From fd2ae945def93c179548dc9578ec071afd702058 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sat, 24 May 2014 05:34:27 +1900 Subject: [PATCH] [PATCH 3/3] test: add tests for Ruby bindings --- d2/08d27344935ba39f8f05c97d5a547e91266e5f | 189 ++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 d2/08d27344935ba39f8f05c97d5a547e91266e5f diff --git a/d2/08d27344935ba39f8f05c97d5a547e91266e5f b/d2/08d27344935ba39f8f05c97d5a547e91266e5f new file mode 100644 index 000000000..077be3749 --- /dev/null +++ b/d2/08d27344935ba39f8f05c97d5a547e91266e5f @@ -0,0 +1,189 @@ +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 2010B431FC4 + for ; Fri, 23 May 2014 03:45:56 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, 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 V95y3NXdnrQl for ; + Fri, 23 May 2014 03:45:52 -0700 (PDT) +Received: from mail-oa0-f52.google.com (mail-oa0-f52.google.com + [209.85.219.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 812C7431FBF + for ; Fri, 23 May 2014 03:45:52 -0700 (PDT) +Received: by mail-oa0-f52.google.com with SMTP id eb12so5306111oac.25 + for ; Fri, 23 May 2014 03:45:52 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=+rT3WnT606MhtF+BlvHH+wn44Xrd6X2aR32HVTAtBn0=; + b=mud0HMO83vzt/UUZQgieWEE7HFxn9uhS78c8xfLtFpI0y5KQa56j+bZ7p1HYseCtBz + Lw3gMlOuDdwH/obkfa/p2j+OVkDLLvG8t8lcULED5WyHt6tP+WUFPykJosNGWQtTv1PJ + G2rGKuZr3fO+MXW1+gtmKeae88YPIBswGvpC79rfCUGmTECZUrxJtCSfvP77MjGksA51 + xo3DXKL183tgtP7DSGb4S4Wk6YyoafcKUc9YXVwDCYPBhbz/SPtf5B9jctodSZX3vV7Z + tiC14cbHeDtJOFx1KEljLC3vir/YfES8zKBWMZlvgTnJmMKDVyLHY6F44x6cKA6u2FIz + Z4vg== +X-Received: by 10.60.55.97 with SMTP id r1mr3811442oep.5.1400841952145; + Fri, 23 May 2014 03:45:52 -0700 (PDT) +Received: from localhost (189-211-224-40.static.axtel.net. [189.211.224.40]) + by mx.google.com with ESMTPSA id ld8sm4881937obb.9.2014.05.23.03.45.50 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 23 May 2014 03:45:51 -0700 (PDT) +From: Felipe Contreras +To: notmuch@notmuchmail.org +Subject: [PATCH 3/3] test: add tests for Ruby bindings +Date: Fri, 23 May 2014 05:34:27 -0500 +Message-Id: <1400841267-12807-4-git-send-email-felipe.contreras@gmail.com> +X-Mailer: git-send-email 1.9.3+fc1~5~gfaddd51 +In-Reply-To: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com> +References: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com> +Cc: Ali Polatel +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, 23 May 2014 10:45:56 -0000 + +Signed-off-by: Felipe Contreras +--- + test/T540-ruby.sh | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + test/test-lib.sh | 1 + + 2 files changed, 99 insertions(+) + create mode 100755 test/T540-ruby.sh + +diff --git a/test/T540-ruby.sh b/test/T540-ruby.sh +new file mode 100755 +index 0000000..a9f6ac5 +--- /dev/null ++++ b/test/T540-ruby.sh +@@ -0,0 +1,98 @@ ++#!/usr/bin/env bash ++# ++# Copyright (c) 2014 Felipe Contreras ++# ++ ++test_description="Ruby bindings" ++ ++. ./test-lib.sh ++ ++export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ++export RUBYLIB=$TEST_DIRECTORY/../bindings/ruby ++ ++if ! test_have_prereq RUBY ++then ++ skip_all='skipping ruby tests' ++ test_done ++fi ++ ++test_ruby () { ++ cat > test.rb <<-\EOF && ++ #!/usr/bin/env ruby ++ ++ require 'notmuch' ++ ++ $MAIL_DIR = ENV['MAIL_DIR'] ++ EOF ++ cat >> test.rb && ++ ruby test.rb ++} ++ ++test_expect_success 'setup' ' ++ add_email_corpus && ++ notmuch new --quiet && ++ export MAIL_DIR ++' ++ ++test_expect_success 'new and close' ' ++ test_ruby <<-\EOF ++ db = Notmuch::Database.new($MAIL_DIR) ++ db.close ++ EOF ++' ++ ++test_expect_success 'open' ' ++ test_ruby <<-\EOF ++ Notmuch::Database.open($MAIL_DIR) do |db| ++ end ++ EOF ++' ++ ++test_expect_success 'path' ' ++ echo $MAIL_DIR > expected && ++ test_ruby > actual <<-\EOF && ++ Notmuch::Database.open($MAIL_DIR) do |db| ++ puts db.path ++ end ++ EOF ++ test_cmp expected actual ++' ++ ++test_expect_success 'query' ' ++ notmuch count "tag:inbox" > expected && ++ test_ruby > actual <<-\EOF && ++ Notmuch::Database.open($MAIL_DIR) do |db| ++ query = db.query("tag:inbox") ++ puts query.count_messages ++ end ++ EOF ++ test_cmp expected actual ++' ++ ++test_expect_success 'query threads' ' ++ notmuch search --output=threads "tag:inbox" > expected && ++ test_ruby > actual <<-\EOF && ++ Notmuch::Database.open($MAIL_DIR) do |db| ++ query = db.query("tag:inbox") ++ query.search_threads.each do |thread| ++ puts "thread:" + thread.thread_id ++ end ++ end ++ EOF ++ test_cmp expected actual ++' ++ ++test_expect_success 'query messages' ' ++ notmuch search --output=messages "tag:inbox" > expected && ++ test_ruby > actual <<-\EOF && ++ Notmuch::Database.open($MAIL_DIR) do |db| ++ query = db.query("tag:inbox") ++ query.search_messages.each do |message| ++ puts "id:" + message.message_id ++ end ++ end ++ EOF ++ test_cmp expected actual ++' ++ ++test_done +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 8697d6a..1f9dd1f 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -1208,6 +1208,7 @@ test_init_ () { + + emacs_generate_script + ++grep -q "WITH_RUBY = 1" ../Makefile.config && test_set_prereq RUBY + + # Use -P to resolve symlinks in our working directory so that the cwd + # in subprocesses like git equals our $PWD (for pathname comparisons). +-- +1.9.3+fc1~5~gfaddd51 + -- 2.26.2