zk/tests/test_get_command.sh

25 lines
440 B
Bash
Raw Normal View History

2023-12-07 17:58:37 +00:00
#!/bin/bash
setup() {
source ../zk
}
test_get_command_returns_list_for_substring() {
commands="list new"
2023-12-07 17:58:37 +00:00
expected="list"
for arg in l li lis list; do
result="$(get_command "$commands" "$arg")"
2023-12-07 17:58:37 +00:00
assert_equals "$expected" "$result"
done
}
test_get_command_does_not_return_match_unless_at_start_of_command_string() {
commands="delete"
expected=""
result="$(get_command "$commands" "l")"
assert_equals "$expected" "$result"
}