File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,18 @@ refute_exists() {
6
6
assert [ ! -e " $1 " ]
7
7
}
8
8
9
+ assert_contains () {
10
+ local item
11
+ local items=(${@: 2} )
12
+ for item in " ${items[@]} " ; do
13
+ if [[ " $item " == " $1 " ]]; then
14
+ return 0
15
+ fi
16
+ done
17
+
18
+ fail " $1 not found in: ${items[@]} "
19
+ }
20
+
9
21
setupNotesEnv () {
10
22
export NOTES_DIRECTORY=" $( mktemp -d) "
11
23
export NOTES_HOME=" $( mktemp -d) "
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ teardown() {
17
17
@test " Should list all commands" {
18
18
touch $NOTES_DIRECTORY /note1.md
19
19
_notes_complete_commands " "
20
- assert_equal " ${COMPREPLY[0]} " ' new '
21
- assert_equal " ${COMPREPLY[1]} " ' find '
22
- assert_equal " ${COMPREPLY[2]} " ' grep '
23
- assert_equal " ${COMPREPLY[3]} " ' open '
20
+ assert_contains " new " ${COMPREPLY[@]}
21
+ assert_contains " find " ${COMPREPLY[@]}
22
+ assert_contains " grep " ${COMPREPLY[@]}
23
+ assert_contains " open " ${COMPREPLY[@]}
24
24
}
25
25
26
26
@test " Should show matching note when found" {
You can’t perform that action at this time.
0 commit comments