Add zsh-autosuggestion
[zsh.git] / .zsh / external / zsh-autosuggestions / test / strategies / default_test.zsh
1 #!/usr/bin/env zsh
2
3 source "${0:a:h}/../test_helper.zsh"
4
5 oneTimeSetUp() {
6 source_autosuggestions
7 }
8
9 testNoMatch() {
10 set_history <<-'EOF'
11 ls foo
12 ls bar
13 EOF
14
15 assertSuggestion \
16 'foo' \
17 ''
18
19 assertSuggestion \
20 'ls q' \
21 ''
22 }
23
24 testBasicMatches() {
25 set_history <<-'EOF'
26 ls foo
27 ls bar
28 EOF
29
30 assertSuggestion \
31 'ls f' \
32 'ls foo'
33
34 assertSuggestion \
35 'ls b' \
36 'ls bar'
37 }
38
39 testMostRecentMatch() {
40 set_history <<-'EOF'
41 ls foo
42 cd bar
43 ls baz
44 cd quux
45 EOF
46
47 assertSuggestion \
48 'ls' \
49 'ls baz'
50
51 assertSuggestion \
52 'cd' \
53 'cd quux'
54 }
55
56 run_tests "$0"