mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 08:58:01 +00:00
ed1919b266
This fails on e.g. an abbr that uses `env a=b`, like the included test demonstrates. Unfortunately it decreases the speed again (2s vs 2.2s vs 4s original), but correctness is more important.
37 lines
822 B
Text
37 lines
822 B
Text
# Test basic add and list
|
|
abbr __abbr1 alpha beta gamma
|
|
abbr | grep __abbr1
|
|
|
|
# Erasing one that doesn't exist should do nothing
|
|
abbr --erase NOT_AN_ABBR
|
|
abbr | grep __abbr1
|
|
|
|
# Adding existing one should be idempotent
|
|
abbr __abbr1 alpha beta gamma
|
|
abbr | grep __abbr1
|
|
|
|
# Replacing
|
|
abbr __abbr1 delta
|
|
abbr | grep __abbr1
|
|
|
|
# -s and --show tests
|
|
abbr -s | grep __abbr1
|
|
abbr --show | grep __abbr1
|
|
|
|
# Test erasing
|
|
abbr -e __abbr1
|
|
abbr | grep __abbr1
|
|
|
|
# Ensure we escape special characters on output
|
|
abbr '~__abbr2' '$xyz'
|
|
abbr | grep __abbr2
|
|
abbr -e '~__abbr2'
|
|
|
|
# Ensure we handle leading dashes in abbreviation names properly
|
|
abbr -- '--__abbr3' 'xyz'
|
|
abbr | grep __abbr3
|
|
abbr -e '--__abbr3'
|
|
|
|
# Ensure we are not recognizing later "=" as separators
|
|
abbr d2 env a=b banana
|
|
abbr -l | string match -q d2; or echo "= test failed"
|