zk/tests/test_get_command.sh

25 lines
440 B
Bash

#!/bin/bash
setup() {
source ../zk
}
test_get_command_returns_list_for_substring() {
commands="list new"
expected="list"
for arg in l li lis list; do
result="$(get_command "$commands" "$arg")"
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"
}