-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathversion-name.bats
More file actions
61 lines (48 loc) · 1.25 KB
/
version-name.bats
File metadata and controls
61 lines (48 loc) · 1.25 KB
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
55
56
57
58
59
60
61
#!/usr/bin/env bats
load test_helper
create_version() {
mkdir -p "${LUAENV_ROOT}/versions/$1"
}
setup() {
mkdir -p "$LUAENV_TEST_DIR"
cd "$LUAENV_TEST_DIR"
}
@test "no version selected" {
assert [ ! -d "${LUAENV_ROOT}/versions" ]
run luaenv-version-name
assert_success "system"
}
@test "system version is not checked for existance" {
LUAENV_VERSION=system run luaenv-version-name
assert_success "system"
}
@test "LUAENV_VERSION has precedence over local" {
create_version "1.8.7"
create_version "1.9.3"
cat > ".lua-version" <<<"1.8.7"
run luaenv-version-name
assert_success "1.8.7"
LUAENV_VERSION=1.9.3 run luaenv-version-name
assert_success "1.9.3"
}
@test "local file has precedence over global" {
create_version "1.8.7"
create_version "1.9.3"
cat > "${LUAENV_ROOT}/version" <<<"1.8.7"
run luaenv-version-name
assert_success "1.8.7"
cat > ".lua-version" <<<"1.9.3"
run luaenv-version-name
assert_success "1.9.3"
}
@test "missing version" {
LUAENV_VERSION=1.2 run luaenv-version-name
assert_failure "luaenv: version \`1.2' is not installed"
}
@test "version with prefix in name" {
create_version "1.8.7"
cat > ".lua-version" <<<"lua-1.8.7"
run luaenv-version-name
assert_success
assert_output "1.8.7"
}