aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/abbr.in
blob: 2086f66cb4f7e4b587f989e2580d89308440de54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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"

abbr "a b c" "d e f"; or true