Fix newline bug

This commit is contained in:
The Magician 2023-12-07 17:58:37 +00:00
parent 274a146175
commit 2ba591635c
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#!/bin/bash
setup() {
source ../zk
}
test_get_command_returns_list_for_substring() {
expected="list"
for arg in l li lis list; do
result="$(get_command "$arg")"
assert_equals "$expected" "$result"
done
}

10
zk
View File

@ -1,5 +1,15 @@
#!/bin/sh #!/bin/sh
COMMANDS='list'
get_command() {
for c in $COMMANDS; do
if echo "$c" | grep "$1" >/dev/null; then
echo "$c"
fi
done
}
main() { main() {
echo "Hello, world" echo "Hello, world"
} }