Debian Codegraph @

scripts/tests/version.sh

raw
1 #!/bin/sh
2
3 # tests the -V switch in fim
4 # TODO : should be integrated in the vim-like test suite.
5
6 f=${FIM_EXE-src/fim} # for e.g. Debian's post-installation tests
7
8 fail()
9 {
10 echo "[!] $@";
11 exit -1;
12 }
13 succeed()
14 {
15 echo "[*] $@";
16 exit 0;
17 }
18
19
20 which grep || fail "we don't go anywhere without grep in our pocket"
21 g="`which grep` -i"
22
23 # -V should return 0
24 $f -V 2>&1 > /dev/null || fail "$f -V returns an incorrect code"
25
26 e='s/^.*://g'
27
28 for s in 'supported output devices' 'supported file formats'
29 do
30 $f -V 2>&1 | $g "$s" || fail "need the $s info message!"
31 [ -z "`$f -V 2>&1 | $g \"$s\" | sed \"$e\"`" ] && fail "no $s ?"
32 done
33 succeed "Version string check based test PASSED"
34
35 exit 0
36