File: version.sh

package info (click to toggle)
fim 0.5~rc2-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,240 kB
  • ctags: 3,308
  • sloc: cpp: 25,233; ansic: 4,390; sh: 1,306; makefile: 398; perl: 189; exp: 25; awk: 9
file content (36 lines) | stat: -rwxr-xr-x 632 bytes parent folder | download | duplicates (4)
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=src/fim 

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