m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 19:03:01 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 19:03:01 +0200
commit094c5b3ca856d57c0dd0c7803a0dbbfe9c9a9a61 (patch)
tree38fd3f085c9f5de694a7827fab2c64fcf6907e3f
parente14a170d577783ba7365555cb464488c72f279ce (diff)
tests: add grep test
-rwxr-xr-xtests/t0400-grep.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/t0400-grep.sh b/tests/t0400-grep.sh
new file mode 100755
index 0000000..0c55cf8
--- /dev/null
+++ b/tests/t0400-grep.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+test_description='Grep check'
+. ./setup.sh
+
+test_expect_success 'Make sure grep prints normal lines' '
+ pass init $KEY1 &&
+ pass insert -e blah1 <<<"hello" &&
+ pass insert -e blah2 <<<"my name is" &&
+ pass insert -e folder/blah3 <<<"I hate computers" &&
+ pass insert -e blah4 <<<"me too!" &&
+ pass insert -e folder/where/blah5 <<<"They are hell" &&
+ results="$(pass grep hell)" &&
+ [[ $(wc -l <<<"$results") -eq 4 ]] &&
+ grep -q blah5 <<<"$results" &&
+ grep -q blah1 <<<"$results" &&
+ grep -q "They are" <<<"$results"
+'
+
+test_done