File: common.sh

package info (click to toggle)
cpu-x 5.4.0-0.2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,380 kB
  • sloc: ansic: 36,860; cpp: 8,094; asm: 7,291; sh: 693; xml: 190; makefile: 11
file content (24 lines) | stat: -rw-r--r-- 360 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
#!/usr/bin/env bash

success() {
	local msg="$1"
	local details="$2"
	echo -e "\033[1;32m$msg\033[0m $details"
}

error() {
	local msg="$1"
	local details="$2"
	echo -e "\033[1;31m$msg\033[0m $details"
}

summary() {
	local failed=$1
	echo
	if [[ $failed -eq 0 ]]; then
		success "All tests passed!"
	else
		error "$failed tests failed."
	fi
	exit "$failed"
}