summaryrefslogtreecommitdiffstats
path: root/test/test_grep_proc.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:55 +0000
commit5068d34c08f951a7ea6257d305a1627b09a95817 (patch)
tree08213e2be853396a3b07ce15dbe222644dcd9a89 /test/test_grep_proc.sh
parentInitial commit. (diff)
downloadlnav-upstream.tar.xz
lnav-upstream.zip
Adding upstream version 0.11.1.upstream/0.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_grep_proc.sh')
-rw-r--r--test/test_grep_proc.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/test_grep_proc.sh b/test/test_grep_proc.sh
new file mode 100644
index 0000000..70b19ba
--- /dev/null
+++ b/test/test_grep_proc.sh
@@ -0,0 +1,57 @@
+#! /bin/bash
+
+cat > gp.dat <<EOF
+Hello, World!
+Goodbye, World?
+EOF
+
+grep_slice() {
+ ./drive_grep_proc "$1" "$2" | ./slicer "$2"
+}
+
+grep_capture() {
+ ./drive_grep_proc "$1" "$2" 1>/dev/null
+}
+
+run_test grep_slice 'Hello' gp.dat
+
+check_output "grep_proc didn't find the right match?" <<EOF
+Hello
+EOF
+
+run_test grep_slice '.*' gp.dat
+
+check_output "grep_proc didn't find all lines?" <<EOF
+Hello, World!
+
+
+Goodbye, World?
+
+
+EOF
+
+run_test grep_slice '\w+,' gp.dat
+
+check_output "grep_proc didn't find the right matches?" <<EOF
+Hello,
+Goodbye,
+EOF
+
+run_test grep_slice '\w+.' gp.dat
+
+check_output "grep_proc didn't find multiple matches?" <<EOF
+Hello,
+World!
+Goodbye,
+World?
+EOF
+
+run_test grep_capture '(\w+), World' gp.dat
+
+check_error_output "grep_proc didn't capture matches?" <<EOF
+0(0:5)Hello
+1(0:7)Goodbye
+EOF
+
+check_output "grep_proc didn't capture matches?" <<EOF
+EOF