mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
17dff8c569
Rewrite the `abbr` function to store each abbreviation in a separate variable. This greatly improves the efficiency. For the common case it is 5x faster. For pathological cases it is upwards of 100x faster. Most people should be able to unconditionally define abbreviations in their config.fish without a noticable slow down. Fixes #4048
25 lines
930 B
Text
25 lines
930 B
Text
# Test basic add and list of __abbr1
|
|
abbr -a -U -- __abbr1 'alpha beta gamma'
|
|
# Erasing one that doesn't exist should do nothing
|
|
abbr -a -U -- __abbr1 'alpha beta gamma'
|
|
# Adding existing __abbr1 should be idempotent
|
|
abbr -a -U -- __abbr1 'alpha beta gamma'
|
|
# Replacing __abbr1 definition
|
|
abbr -a -U -- __abbr1 delta
|
|
# __abbr1 -s and --show tests
|
|
abbr -a -U -- __abbr1 delta
|
|
abbr -a -U -- __abbr1 delta
|
|
# Test erasing __abbr1
|
|
# Ensure we escape special characters on output
|
|
abbr -a -U -- '~__abbr2' '$xyz'
|
|
# Ensure we handle leading dashes in abbreviation names properly
|
|
abbr -a -U -- --__abbr3 xyz
|
|
# Test that an abbr word containing spaces is rejected
|
|
# Test renaming
|
|
abbr -a -U -- __abbr5 omega
|
|
# Test renaming a nonexistent abbreviation
|
|
# Test renaming to a abbreviation with spaces
|
|
# Test renaming without arguments
|
|
# Test renaming with too many arguments
|
|
abbr -a -U -- __abbr8 omega
|
|
# Test renaming to existing abbreviation
|