]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - tests/lib.sh.test
Add tests for BSD which on Mac OS X.
[config/dotfiles.git] / tests / lib.sh.test
1 # Tests for lib.sh.
2
3
4 . ../lib.sh
5
6 # Tests for installed() with hopefully proper exit codes (1 if the program was
7 # not found).
8 installed ls && echo ls installed
9 installed doesnt-exist && echo doesnt-exist installed
10 # Simulate BSD `which` like on Mac OS X which doesn't use exit codes.
11 function which() {
12     echo Mac OS X which for $1 >&2
13     if [ $1 = ls ]; then
14         echo /bin/ls
15     else
16         echo no doesnt-exist in /usr/bin /bin /usr/sbin /sbin
17     fi
18 }
19 # Tests for installed() without exit codes.
20 installed ls && echo ls installed
21 installed doesnt-exist && echo doesnt-exist installed