feat: add plugins for zsh

This commit is contained in:
2024-09-22 20:14:22 +04:00
parent f4c1c54e72
commit 6c85cc3b71
515 changed files with 30838 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env zunit
@setup {
load "../you-should-use.plugin.zsh"
# Simplify format for tests
YSU_MESSAGE_FORMAT='Found existing %alias_type for "%command". You should use: "%alias"'
unset YSU_MESSAGE_POSITION
}
@teardown {
}
@test 'global aliases no match' {
alias -g hw="Hello World!"
run _check_global_aliases "echo 'hello'"
assert "$output" is_empty
assert $state equals 0
}
@test 'global aliases match' {
alias -g NE="2>/dev/null"
run _check_global_aliases "echo 'hello' 2>/dev/null"
assert "$output" contains 'Found existing global alias for "2>/dev/null". You should use: "NE"'
assert $state equals 0
}
@test 'test doesnt match substrings' {
alias -g n="nvim"
run _check_global_aliases "nvimkaowjqwe"
assert "$output" is_empty
assert $state equals 0
}
@test 'global aliases ignore on sudo' {
alias -g NE="2>/dev/null"
run _check_global_aliases "sudo echo 'hello' 2>/dev/null"
assert "$output" is_empty
assert $state equals 0
}
@test 'global aliases - does not report an ignored alias' {
export YSU_MODE="ALL"
export YSU_IGNORED_GLOBAL_ALIASES=("..." "NE")
alias -g ...="../.."
run _check_global_aliases "cd ../.."
assert $output is_empty
assert $state equals 0
}