Commit e8a2b3a63c14841b7dc04d43014edd9faa687885
1 parent
eb1ebaf3c0
Added tests for loading prezto's `init.zsh`.
Showing 2 changed files with 18 additions and 2 deletions Inline Diff
tests/.zshenv
1 | # zshrc file written for antigen's tests. Might not be a good one for daily use. | 1 | # zshrc file written for antigen's tests. Might not be a good one for daily use. |
2 | 2 | ||
3 | # See cram's documentation for some of the variables used below. | 3 | # See cram's documentation for some of the variables used below. |
4 | 4 | ||
5 | export ADOTDIR="$PWD/dot-antigen" | 5 | export ADOTDIR="$PWD/dot-antigen" |
6 | 6 | ||
7 | test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump" | 7 | test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump" |
8 | 8 | ||
9 | source "$TESTDIR/../antigen.zsh" | 9 | source "$TESTDIR/../antigen.zsh" |
10 | 10 | ||
11 | # A test plugin repository to test out antigen with. | 11 | # A test plugin repository to test out antigen with. |
12 | 12 | ||
13 | export PLUGIN_DIR="$PWD/test-plugin" | 13 | export PLUGIN_DIR="$PWD/test-plugin" |
14 | mkdir "$PLUGIN_DIR" | 14 | mkdir "$PLUGIN_DIR" |
15 | 15 | ||
16 | # A wrapper function over `git` to work with the test plugin repo. | 16 | # A wrapper function over `git` to work with the test plugin repo. |
17 | alias pg='git --git-dir "$PLUGIN_DIR/.git" --work-tree "$PLUGIN_DIR"' | 17 | alias pg='git --git-dir "$PLUGIN_DIR/.git" --work-tree "$PLUGIN_DIR"' |
18 | 18 | ||
19 | echo 'alias hehe="echo hehe"' > "$PLUGIN_DIR"/aliases.zsh | 19 | echo 'alias hehe="echo hehe"' > "$PLUGIN_DIR"/aliases.zsh |
20 | echo 'export PS1="prompt>"' > "$PLUGIN_DIR"/silly.zsh-theme | 20 | echo 'export PS1="prompt>"' > "$PLUGIN_DIR"/silly.zsh-theme |
21 | 21 | ||
22 | { | 22 | { |
23 | pg init | 23 | pg init |
24 | pg add . | 24 | pg add . |
25 | pg commit -m 'Initial commit' | 25 | pg commit -m 'Initial commit' |
26 | } > /dev/null | 26 | } > /dev/null |
27 | 27 | ||
28 | # Another test plugin. | 28 | # Another test plugin. |
29 | 29 | ||
30 | export PLUGIN_DIR2="$PWD/test-plugin2" | 30 | export PLUGIN_DIR2="$PWD/test-plugin2" |
31 | mkdir "$PLUGIN_DIR2" | 31 | mkdir "$PLUGIN_DIR2" |
32 | 32 | ||
33 | # A wrapper function over `git` to work with the test plugin repo. | 33 | # A wrapper function over `git` to work with the test plugin repo. |
34 | alias pg2='git --git-dir "$PLUGIN_DIR2/.git" --work-tree "$PLUGIN_DIR2"' | 34 | alias pg2='git --git-dir "$PLUGIN_DIR2/.git" --work-tree "$PLUGIN_DIR2"' |
35 | 35 | ||
36 | echo 'alias hehe2="echo hehe2"' > "$PLUGIN_DIR2"/aliases.zsh | 36 | echo 'alias hehe2="echo hehe2"' > "$PLUGIN_DIR2"/init.zsh |
37 | echo 'alias unsourced-alias="echo unsourced-alias"' > "$PLUGIN_DIR2"/aliases.zsh | ||
37 | 38 | ||
38 | { | 39 | { |
39 | pg2 init | 40 | pg2 init |
40 | pg2 add . | 41 | pg2 add . |
41 | pg2 commit -m 'Initial commit' | 42 | pg2 commit -m 'Initial commit' |
42 | } > /dev/null | 43 | } > /dev/null |
43 | 44 |
tests/bundle.t
1 | Load plugin from master. | 1 | Load plugin from master. |
2 | 2 | ||
3 | $ antigen-bundle $PLUGIN_DIR | 3 | $ antigen-bundle $PLUGIN_DIR |
4 | Cloning into '.+?'\.\.\. (re) | 4 | Cloning into '*'... (glob) |
5 | done. | 5 | done. |
6 | $ hehe | 6 | $ hehe |
7 | hehe | 7 | hehe |
8 | 8 | ||
9 | Load the plugin again. Just to see nothing happens. | 9 | Load the plugin again. Just to see nothing happens. |
10 | 10 | ||
11 | $ antigen-bundle $PLUGIN_DIR | 11 | $ antigen-bundle $PLUGIN_DIR |
12 | $ hehe | 12 | $ hehe |
13 | hehe | 13 | hehe |
14 | 14 | ||
15 | Confirm there is still only one repository. | 15 | Confirm there is still only one repository. |
16 | 16 | ||
17 | $ ls $ADOTDIR/repos | wc -l | 17 | $ ls $ADOTDIR/repos | wc -l |
18 | 1 | 18 | 1 |
19 | |||
20 | Load a prezto style module. Should only source the `init.zsh` present in the | ||
21 | module. | ||
22 | |||
23 | $ antigen-bundle $PLUGIN_DIR2 | ||
24 | Cloning into '*'... (glob) | ||
25 | done. | ||
26 | $ hehe2 | ||
27 | hehe2 | ||
28 | |||
29 | The alias defined in the other zsh file should not be available. | ||
30 | |||
31 | $ unsourced-alias | ||
32 | zsh: command not found: unsourced-alias | ||
33 | [127] | ||
19 | 34 |