mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-28 04:35:09 +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
22 lines
999 B
Text
22 lines
999 B
Text
# Test basic add and list of __abbr1
|
|
# Erasing one that doesn't exist should do nothing
|
|
abbr --erase: No abbreviation named NOT_AN_ABBR
|
|
# Adding existing __abbr1 should be idempotent
|
|
# Replacing __abbr1 definition
|
|
# __abbr1 -s and --show tests
|
|
# Test erasing __abbr1
|
|
# Ensure we escape special characters on output
|
|
# Ensure we handle leading dashes in abbreviation names properly
|
|
# Test that an abbr word containing spaces is rejected
|
|
abbr --add: Abbreviation 'a b c' cannot have spaces in the word
|
|
# Test renaming
|
|
# Test renaming a nonexistent abbreviation
|
|
abbr --rename: No abbreviation named __abbr6
|
|
# Test renaming to a abbreviation with spaces
|
|
abbr --rename: Abbreviation 'g h i' cannot have spaces in the word
|
|
# Test renaming without arguments
|
|
abbr --rename: Requires exactly two arguments
|
|
# Test renaming with too many arguments
|
|
abbr --rename: Requires exactly two arguments
|
|
# Test renaming to existing abbreviation
|
|
abbr --rename: Abbreviation __abbr12 already exists, cannot rename __abbr11
|