-
-
Notifications
You must be signed in to change notification settings - Fork 377
/
Copy pathvariabletest
52 lines (41 loc) · 1.1 KB
/
variabletest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -eu
THIS="$(readlink -f "$0")"
THISDIR="$(dirname "${THIS}")"
SUT="$(dirname "${THISDIR}")/makeself.sh"
setupTests() {
temp=`mktemp -d -t XXXXX`
cd "$temp"
mkdir archive
touch archive/file
# $SUT archive makeself-test.run "Test $1" declare -p "${1}"
$SUT archive makeself-test.run "Test $1" echo \\\"\${${1}}\\\"
}
testArchiveDir()
{
setupTests ARCHIVE_DIR
local ans=$'./complicated\n dir\twith spaces'
mkdir "${ans}"
mv ./makeself-test.run "${ans}/"
actual_archive_dir="$("${ans}/makeself-test.run" --quiet)"
assertEquals "${actual_archive_dir}" "${ans}"
}
testTmpRoot()
{
setupTests TMPROOT
local ans="${temp}"$'/complicated\n dir\twith spaces'
mkdir -p "${ans}"
actual_tmp_root="$(TMPDIR="${ans}" "./makeself-test.run" --quiet)"
assertEquals "${actual_tmp_root}" "${ans}"
}
testUserPWD()
{
setupTests USER_PWD
local ans="${temp}"$'/complicated\n dir\twith spaces'
mkdir -p "${ans}"
cd "${ans}"
actual_user_pwd="$("${temp}/makeself-test.run" --quiet)"
assertEquals "${actual_user_pwd}" "${ans}"
}
# Load and run shUnit2.
source "./shunit2/shunit2"