forked from adoyle-h/lobash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis_undefined.bats
47 lines (40 loc) · 867 Bytes
/
is_undefined.bats
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
#!/usr/bin/env bats
setup_fixture
test_prepare is_undefined
load_module is_undefined
@test "l.is_undefined <exported variable> -> false" {
export a=1
run l.is_undefined a
assert_failure
assert_output ''
}
@test "l.is_undefined <unexported variable>-> false" {
b=1
run l.is_undefined b
assert_failure
assert_output ''
}
@test "l.is_undefined <undefined variable> -> true" {
run l.is_undefined c
assert_success
assert_output ''
}
@test "l.is_undefined <readonly variable> -> false" {
d=1
readonly
run l.is_undefined d
assert_failure
assert_output ''
}
@test "l.is_undefined <array variable> -> false" {
declare -a e=(1)
run l.is_undefined e
assert_failure
assert_output ''
}
@test "l.is_undefined <associate array variable> -> false" {
declare -A f=([foo]=1)
run l.is_undefined f
assert_failure
assert_output ''
}