-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·54 lines (42 loc) · 1.18 KB
/
test.sh
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
53
54
#!/usr/bin/env bash
# ASSERT_OUTPUT is used in assert
# shellcheck disable=SC2034
set -e
source assert.sh
./prepare-test-data.sh
export RH_PROJECTS_DIRS="$PWD/temp/a:$PWD/temp/b"
export RH_ROS_INSTALL_DIRS="$PWD/temp/home/another/ros:$PWD/temp/opt/ros"
export RH_SRC="$PWD/rh.sh"
# shellcheck source=rh.sh
source "$RH_SRC"
# see the following link for info about multiline strings (heredoc)
# https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Here-Documents
# tl;dr:
# <<EOF marks heredoc start
# <<"EOF" marks heredoc start but no expansion
# <<-EOF marks heredoc start and all leading tab characters are stripped from input lines
# and the line containing delimiter
# <<-"EOF" no expansion and all leading tab characters are stripped
assert-prepare "$PWD/test"
assert "rh env"
assert "rh versions"
assert "rh sw foxtrot" 1
assert "rh sw foxy --silent"
assert "rh sw kinetic --silent"
ASSERT_OUTPUT="$(
cat <<-"EOF"
temp/a/1
temp/b/4
temp/b/5/ws
EOF
)"
assert "__rh_get_workspaces temp" 0
assert "rh projects"
assert "rh cd 5"
assert "rh wcd"
assert "rh dev"
assert "rh ldev" 1
assert "rh cd 4"
assert "rh ldev"
print-success "ALL TESTS PASSED"
assert-cleanup