Add zsh-autosuggestion
[zsh.git] / .zsh / external / zsh-autosuggestions / test / bind_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 testInvokeOriginalWidgetDefined() {
10 stub_and_eval \
11 zle \
12 'return 1'
13
14 _zsh_autosuggest_invoke_original_widget 'self-insert'
15
16 assertEquals \
17 '1' \
18 "$?"
19
20 assertTrue \
21 'zle was not invoked' \
22 'stub_called zle'
23
24 restore zle
25 }
26
27 testInvokeOriginalWidgetUndefined() {
28 stub_and_eval \
29 zle \
30 'return 1'
31
32 _zsh_autosuggest_invoke_original_widget 'some-undefined-widget'
33
34 assertEquals \
35 '0' \
36 "$?"
37
38 assertFalse \
39 'zle was invoked' \
40 'stub_called zle'
41
42 restore zle
43 }
44
45 run_tests "$0"