Debian Codegraph @

test/helper.sh

raw symbols SCIP
1 for bin in lsrc mkrc rcup rcdn; do
2 chmodscip-shell system . . chmod. +x "$TESTDIR/../bin"/$bin
3 done
4
5 export HOME="$PWD"
6 export PATH="$TESTDIR/../bin:$PATH"
7 export RCRC="$HOME/.rcrc"
8 export RCM_LIB="$TESTDIR/../share"
9
10 mkdirscip-shell system . . mkdir. .dotfiles
11
12 hostnamescip-shell shell shell-project 0.0.0 hostname().() {
13 if [scip-shell system . . `[`. -n "$HOSTNAME" ]; then
14 echoscip-shell system . . echo. "$HOSTNAME"
15 else
16 command hostname | sedscip-shell system . . sed. -e 's/\..*//'
17 fi
18 }
19
20 assertscip-shell shell shell-project 0.0.0 assert().() {
21 local msg="$1"; shift
22
23 testscip-shell system . . test. "$@" || echoscip-shell system . . echo. "Failed assertion: $msg"
24
25 return 0
26 }
27
28 refutescip-shell shell shell-project 0.0.0 refute().() {
29 local msg="$1"; shift
30
31 testscip-shell system . . test. "$@" && echoscip-shell system . . echo. "Failed assertion: $msg"
32
33 return 0
34 }
35
36 resolved_pathscip-shell shell shell-project 0.0.0 resolved_path().() {
37 local original_path="$1"
38 perlscip-shell system . . perl. -e \
39 "use Cwd realpath; print realpath(\"$original_path\") . \"\\n\";"
40 }
41
42 assert_linkedscip-shell shell shell-project 0.0.0 assert_linked().() {
43 local from="$1" to="$2"
44 local resolved="$(resolved_pathscip-shell shell shell-project 0.0.0 resolved_path(). "$from")"
45
46 assertscip-shell shell shell-project 0.0.0 assert(). "$from should be a symlink" -h "$from"
47 assertscip-shell shell shell-project 0.0.0 assert(). "$from should resolve to $to, resolved to $resolved" "$resolved" = "$to"
48 }