File: version.sh

package info (click to toggle)
fim 0.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,048 kB
  • sloc: cpp: 32,769; ansic: 4,507; makefile: 1,549; sh: 1,502; perl: 189; exp: 28; awk: 9
file content (36 lines) | stat: -rwxr-xr-x 686 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# tests the -V switch in fim
# TODO : should be integrated in the vim-like test suite.

f=${FIM_EXE-src/fim} # for e.g. Debian's post-installation tests

fail()
{
	echo "[!] $@";
	exit -1;
}
succeed()
{
	echo "[*] $@";
	exit 0;
}


which grep || fail "we don't go anywhere without grep in our pocket"
g="`which grep` -i"

# -V should return 0
$f -V 2>&1 > /dev/null || fail "$f -V returns an incorrect code"

e='s/^.*://g'

for s in 'supported output devices' 'supported file formats'
do
	$f -V 2>&1 | $g "$s" || fail "need the $s info message!"
	[ -z "`$f -V 2>&1 | $g \"$s\" | sed \"$e\"`" ] && fail "no $s ?"
done
succeed "Version string check based test PASSED"

exit 0