first commit
This commit is contained in:
commit
205faf4224
5471 changed files with 973850 additions and 0 deletions
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env zunit
|
||||
|
||||
@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"'
|
||||
# hardcore mode is not enabled and should not show up
|
||||
assert "$output" does_not_contain 'hardcore mode enabled'
|
||||
assert $state equals 0
|
||||
}
|
||||
|
||||
@test 'global aliases match - with hardcore mode enabled' {
|
||||
alias -g NE="2>/dev/null"
|
||||
export YSU_HARDCORE=1
|
||||
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 "$output" contains 'hardcore mode enabled'
|
||||
assert $state equals $HARDCORE_EXIT_CODE
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue