summaryrefslogtreecommitdiffstats
path: root/test/test_scripts.sh
blob: cbd43e4bd6c9dea27e96d4959991138390614c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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