git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Test grep --and/--or/--not

From
Thomas Rast <trast@student.ethz.ch>
Date
Jun 27, 2009, 18:47 UTC
Message-ID
<00cb3d5121573fd1208bd297ab13ee4be966e915.1246128025.git.trast@student.ethz.ch>
In-Reply-To
<dac606a8ee9b87339d1cf4b1bff23cea3c1b1c23.1246128025.git.trast@student.ethz.ch>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t7002-grep.sh |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index f275af8..7868af8 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -125,6 +125,36 @@ do
 
 done
 
+cat >expected <<EOF
+file:foo mmap bar_mmap
+EOF
+
+test_expect_success 'grep -e A --and -e B' '
+	git grep -e "foo mmap" --and -e bar_mmap >actual &&
+	test_cmp expected actual
+'
+
+cat >expected <<EOF
+file:foo_mmap bar mmap
+file:foo_mmap bar mmap baz
+EOF
+
+
+test_expect_success 'grep ( -e A --or -e B ) --and -e B' '
+	git grep \( -e foo_ --or -e baz \) \
+		--and -e " mmap" >actual &&
+	test_cmp expected actual
+'
+
+cat >expected <<EOF
+file:foo mmap bar
+EOF
+
+test_expect_success 'grep -e A --and --not -e B' '
+	git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
+	test_cmp expected actual
+'
+
 test_expect_success 'log grep setup' '
 	echo a >>file &&
 	test_tick &&
-- 
1.6.3.3.423.ga0175
Previous: Thomas Rast
Message 2 of 2 in “Test git archive --remote”
  1. 1/2 Test git archive --remoteThomas Rast, Jun 27, 2009
  2. 2/2 Test grep --and/--or/--notThomas Rast, Jun 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.