List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH 3/3] t0111: Check all arguments
Date: Tue, 14 Jan 2014 22:25:47 +0100	[thread overview]
Message-ID: <1389734747-7135-3-git-send-email-cgit@cryptocrack.de> (raw)
In-Reply-To: <1389734747-7135-1-git-send-email-cgit@cryptocrack.de>

In the filter checks, check whether all arguments are passed properly
instead of validating the buffer/stdin only.

Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
 tests/filters/capitalize-buffer.lua | 3 +++
 tests/filters/capitalize-stdin.sh   | 1 +
 tests/t0111-filter.sh               | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/filters/capitalize-buffer.lua b/tests/filters/capitalize-buffer.lua
index 7ca4ec6..1f15c93 100644
--- a/tests/filters/capitalize-buffer.lua
+++ b/tests/filters/capitalize-buffer.lua
@@ -1,5 +1,8 @@
 function filter_open(...)
 	buffer = ""
+	for i = 1, select("#", ...) do
+		buffer = buffer .. select(i, ...) .. " "
+	end
 end
 
 function filter_close()
diff --git a/tests/filters/capitalize-stdin.sh b/tests/filters/capitalize-stdin.sh
index c9f4719..da6f7a1 100755
--- a/tests/filters/capitalize-stdin.sh
+++ b/tests/filters/capitalize-stdin.sh
@@ -1,3 +1,4 @@
 #!/bin/sh
 
+[ "$#" -gt 0 ] && printf "%s " "$*"
 tr '[:lower:]' '[:upper:]'
diff --git a/tests/t0111-filter.sh b/tests/t0111-filter.sh
index dab6aa8..c89020a 100755
--- a/tests/t0111-filter.sh
+++ b/tests/t0111-filter.sh
@@ -10,7 +10,7 @@ do
 	"
 
 	test_expect_success "check whether the $prefix source filter works" '
-		grep "<code>HELLO$" tmp
+		grep "<code>a+b HELLO$" tmp
 	'
 
 	test_expect_success "generate filter-$prefix/about/" "
@@ -18,7 +18,7 @@ do
 	"
 
 	test_expect_success "check whether the $prefix about filter works" '
-		grep "<div id='"'"'summary'"'"'>HELLO$" tmp
+		grep "<div id='"'"'summary'"'"'>a+b HELLO$" tmp
 	'
 
 	test_expect_success "generate filter-$prefix/commit/" "
-- 
1.8.5.2



  parent reply	other threads:[~2014-01-14 21:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 21:25 [PATCH v2 1/3] t0111: Prepare for other filter prefixes cgit
2014-01-14 21:25 ` [PATCH v2 2/3] t0111: Add basic tests for Lua filters cgit
2014-01-14 21:25 ` cgit [this message]
2014-01-15 13:46   ` [PATCH 3/3] t0111: Check all arguments Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389734747-7135-3-git-send-email-cgit@cryptocrack.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).