summaryrefslogtreecommitdiffstats
path: root/test/test_scripts.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_scripts.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_scripts.sh')
-rw-r--r--test/test_scripts.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_scripts.sh b/test/test_scripts.sh
new file mode 100644
index 0000000..cbd43e4
--- /dev/null
+++ b/test/test_scripts.sh
@@ -0,0 +1,51 @@
+#! /bin/bash
+
+lnav_test="${top_builddir}/src/lnav-test"
+
+touch scripts-empty
+
+run_test ${lnav_test} -n -d /tmp/lnav.err \
+ -I ${test_dir} \
+ -f 'multiline-echo' \
+ scripts-empty
+
+check_error_output "multiline-echo has errors?" <<EOF
+EOF
+
+check_output "multiline-echo is not working?" <<EOF
+Hello, World!
+Goodbye, World!
+EOF
+
+run_test ${lnav_test} -n -d /tmp/lnav.err \
+ -I ${test_dir} \
+ -f 'redirecting' \
+ scripts-empty
+
+check_error_output "redirecting has errors?" <<EOF
+EOF
+
+check_output "redirecting is not working?" <<EOF
+Howdy!
+Goodbye, World!
+EOF
+
+diff -w -u - hw.txt <<EOF
+Hello, World!
+HOWDY!
+GOODBYE, WORLD!
+EOF
+
+if test $? -ne 0; then
+ echo "Script output was not redirected?"
+ exit 1
+fi
+
+diff -w -u - hw2.txt <<EOF
+HELLO, WORLD!
+EOF
+
+if test $? -ne 0; then
+ echo "Script output was not redirected?"
+ exit 1
+fi