mirror of
https://github.com/denisidoro/navi
synced 2024-11-21 19:13:07 +00:00
Fix tldr test (#669)
This commit is contained in:
parent
a3a48419de
commit
f3e237de4a
2 changed files with 16 additions and 3 deletions
|
@ -46,7 +46,7 @@ test::_escape() {
|
|||
|
||||
test::equals() {
|
||||
local -r actual="$(cat)"
|
||||
local -r expected="$(echo "${1:-}")"
|
||||
local -r expected="${1:-}"
|
||||
|
||||
local -r actual2="$(echo "$actual" | test::_escape)"
|
||||
local -r expected2="$(echo "$expected" | test::_escape)"
|
||||
|
@ -57,6 +57,19 @@ test::equals() {
|
|||
fi
|
||||
}
|
||||
|
||||
test::contains() {
|
||||
local -r haystack="$(cat)"
|
||||
local -r needle="${1:-}"
|
||||
|
||||
local -r haystack2="$(echo "$haystack" | test::_escape)"
|
||||
local -r needle2="$(echo "$needle" | test::_escape)"
|
||||
|
||||
if [[ "$haystack2" != *"$needle2"* ]]; then
|
||||
log::error "Expected '${haystack}' to include '${needle2}'"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
test::finish() {
|
||||
echo
|
||||
if [ $SKIPPED -gt 0 ]; then
|
||||
|
|
|
@ -53,12 +53,12 @@ _get_tests() {
|
|||
|
||||
_navi_tldr() {
|
||||
_navi --tldr docker --query ps --print --best-match \
|
||||
| test::equals "docker ps"
|
||||
| test::contains "docker ps"
|
||||
}
|
||||
|
||||
_navi_cheatsh() {
|
||||
_navi --cheatsh docker --query remove --print --best-match \
|
||||
| test::equals "docker rm container_name"
|
||||
| test::contains "docker rm"
|
||||
}
|
||||
|
||||
_navi_widget() {
|
||||
|
|
Loading…
Reference in a new issue