hb

A handbook for UNIX

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
#!/bin/sh

logfile=test.log

export HB_PATH=sample
export EDITOR=ls
export FUZZER="xargs"

test_browse() { FUZZER="echo good_file.txt" ./hb; }

test_browsefail() { ! FUZZER="echo bad_file.txt" ./hb; }

test_nonexistentfile() { ! ./hb n -c nonexistentfile; }

test_existentfile() { ./hb n -c COPYING; }

set -- browse browsefail nonexistentfile existentfile
date +"==========[%Y/%m/%d %H:%M:%S]==========" >> $logfile
while [ $# -gt 0 ]; do
	echo "# Running test ... $1" >> $logfile
	echo "# Running test ... $1" $(if 1>>$logfile 2>>$logfile "test_$1" ; then echo "Passed"; else echo "Falied"; fi)
	shift
done