forked from adoyle-h/lobash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhas_not.bats
112 lines (91 loc) · 2.03 KB
/
has_not.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bats
setup_fixture
test_prepare has_not
load_module has_not
@test "l.has_not command cat, while cat is existed" {
run l.has_not command cat
assert_failure
assert_output ''
}
@test "l.has_not command xxx, which not defined" {
run l.has_not command xxx
assert_success
assert_output ''
}
@test "l.has_not function bbb, which not defined" {
run l.has_not function bbb
assert_success
assert_output ''
}
@test "l.has_not function bbb, which has been defined" {
bbb() { echo 1; }
run l.has_not function bbb
assert_failure
assert_output ''
}
@test "l.has_not builtin true" {
run l.has_not builtin true
assert_failure
assert_output ''
}
@test "l.has_not builtin xxx, which not defined" {
run l.has_not builtin xxx
assert_success
assert_output ''
}
@test "l.has_not keyword function" {
run l.has_not keyword function
assert_failure
assert_output ''
}
@test "l.has_not keyword xxx, which not defined" {
run l.has_not keyword xxx
assert_success
assert_output ''
}
@test "l.has_not alias xxx, which not defined" {
run l.has_not alias xxx
assert_success
assert_output ''
}
@test "l.has_not alias gti, which has been defined" {
shopt -s expand_aliases
alias gti='git'
run l.has_not alias gti
assert_failure
assert_output ''
shopt -u expand_aliases
}
@test "l.has_not the xxx, which not defined" {
run l.has_not the xxx
assert_success
assert_output ''
}
@test "l.has_not the ls, which is command" {
run l.has_not the ls
assert_failure
assert_output ''
}
@test "l.has_not the agti, which is alias" {
shopt -s expand_aliases
alias agti='git'
run l.has_not the agti
assert_failure
assert_output ''
shopt -u expand_aliases
}
@test "l.has_not the function, which is keyword" {
run l.has_not the function
assert_failure
assert_output ''
}
@test "l.has_not the type, which is builtin" {
run l.has_not the type
assert_failure
assert_output ''
}
@test "l.has_not what type" {
run l.has_not what type
assert_failure 3
assert_output 'Invalid Condition: what'
}