🍦.
[pin4sha_cgi.git] / scripts / assert.sh
blob0d20629f386c33f2448351ece5799968238d3900
2 # Copyright (c) 2015 Marcus Rohrmoser http://mro.name/me. All rights reserved.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # insipired by https://github.com/lehmannro/assert.sh but much more primitive.
20 # terminal colors (require bash)
21 # http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
22 # http://wiki.bash-hackers.org/scripting/terminalcodes
23 FGC_NONE="\033[0m"
24 FGC_GRAY="\033[1;30m"
25 FGC_RED="\033[1;31m"
26 FGC_GREEN="\033[1;32m"
27 FGC_YELLOW="\033[1;33m"
28 FGC_BLUE="\033[1;34m"
29 FGC_PURPLE="\033[1;35m"
30 FGC_CYAN="\033[1;36m"
31 FGC_WHITE="\033[1;37m"
32 BGC_GRAY="\033[7;30m"
33 BGC_RED="\033[7;31m"
34 BGC_GREEN="\033[7;32m"
35 BGC_YELLOW="\033[7;33m"
36 BGC_BLUE="\033[7;34m"
37 BGC_PURPLE="\033[7;35m"
38 BGC_CYAN="\033[7;36m"
39 BGC_WHITE="\033[7;37m"
41 assert_fail() {
42 echo "${BGC_RED}Assert fail ($1): $2${FGC_NONE}"
43 exit $1