Commit 293eecb9065b329af83080a0990ab9371b3e4620
1 parent
e97637cd0f
Remove hard coded test plugin directory name.
Showing 3 changed files with 10 additions and 9 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 | default_clone="/tmp/antigen-tests-clone-cache" | 5 | default_clone="/tmp/antigen-tests-clone-cache" |
| 6 | 6 | ||
| 7 | if [[ ! -d "$default_clone" ]]; then | 7 | if [[ ! -d "$default_clone" ]]; then |
| 8 | git clone https://github.com/robbyrussell/oh-my-zsh.git "$default_clone" | 8 | git clone https://github.com/robbyrussell/oh-my-zsh.git "$default_clone" |
| 9 | fi | 9 | fi |
| 10 | 10 | ||
| 11 | export ANTIGEN_DEFAULT_REPO_URL="$default_clone" | 11 | export ANTIGEN_DEFAULT_REPO_URL="$default_clone" |
| 12 | export ADOTDIR="$PWD/dot-antigen" | 12 | export ADOTDIR="$PWD/dot-antigen" |
| 13 | 13 | ||
| 14 | rm "$TESTDIR/.zcompdump" | 14 | rm "$TESTDIR/.zcompdump" |
| 15 | 15 | ||
| 16 | source "$TESTDIR/../antigen.zsh" | 16 | source "$TESTDIR/../antigen.zsh" |
| 17 | 17 | ||
| 18 | # A test plugin repository to test out antigen with. | 18 | # A test plugin repository to test out antigen with. |
| 19 | 19 | ||
| 20 | mkdir test-plugin | 20 | export PLUGIN_DIR="$PWD/test-plugin" |
| 21 | mkdir "$PLUGIN_DIR" | ||
| 21 | 22 | ||
| 22 | # A wrapper function over `git` to work with the test plugin repo. | 23 | # A wrapper function over `git` to work with the test plugin repo. |
| 23 | pg () { | 24 | pg () { |
| 24 | git --git-dir test-plugin/.git --work-tree test-plugin "$@" | 25 | git --git-dir "$PLUGIN_DIR"/.git --work-tree "$PLUGIN_DIR" "$@" |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | cat > test-plugin/aliases.zsh <<EOF | 28 | cat > "$PLUGIN_DIR"/aliases.zsh <<EOF |
| 28 | alias hehe='echo hehe' | 29 | alias hehe='echo hehe' |
| 29 | EOF | 30 | EOF |
| 30 | 31 | ||
| 31 | { | 32 | { |
| 32 | pg init | 33 | pg init |
| 33 | pg add . | 34 | pg add . |
| 34 | pg commit -m 'Initial commit' | 35 | pg commit -m 'Initial commit' |
| 35 | } > /dev/null | 36 | } > /dev/null |
| 36 | 37 |
tests/branch-bundle.t
| 1 | Branch b1. | 1 | Branch b1. |
| 2 | 2 | ||
| 3 | $ pg branch b1 | 3 | $ pg branch b1 |
| 4 | $ pg checkout b1 | 4 | $ pg checkout b1 |
| 5 | Switched to branch 'b1' | 5 | Switched to branch 'b1' |
| 6 | $ cat > test-plugin/aliases.zsh <<EOF | 6 | $ cat > $PLUGIN_DIR/aliases.zsh <<EOF |
| 7 | > alias hehe='echo hehe from b1' | 7 | > alias hehe='echo hehe from b1' |
| 8 | > EOF | 8 | > EOF |
| 9 | $ pg commit -am 'Change for b1' | 9 | $ pg commit -am 'Change for b1' |
| 10 | \[b1 [a-f0-9]{7}\] Change for b1 (re) | 10 | \[b1 [a-f0-9]{7}\] Change for b1 (re) |
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 12 | 12 | ||
| 13 | Go back to master. | 13 | Go back to master. |
| 14 | 14 | ||
| 15 | $ pg checkout master | 15 | $ pg checkout master |
| 16 | Switched to branch 'master' | 16 | Switched to branch 'master' |
| 17 | 17 | ||
| 18 | Load plugin from b1. | 18 | Load plugin from b1. |
| 19 | 19 | ||
| 20 | $ antigen-bundle $PWD/test-plugin --branch=b1 | 20 | $ antigen-bundle $PLUGIN_DIR --branch=b1 |
| 21 | Cloning into '.+?'\.\.\. (re) | 21 | Cloning into '.+?'\.\.\. (re) |
| 22 | done. | 22 | done. |
| 23 | Switched to a new branch 'b1' | 23 | Switched to a new branch 'b1' |
| 24 | Branch b1 set up to track remote branch b1 from origin. | 24 | Branch b1 set up to track remote branch b1 from origin. |
| 25 | $ hehe | 25 | $ hehe |
| 26 | hehe from b1 | 26 | hehe from b1 |
| 27 | 27 | ||
| 28 | Load plugin from master. | 28 | Load plugin from master. |
| 29 | 29 | ||
| 30 | $ antigen-bundle $PWD/test-plugin | 30 | $ antigen-bundle $PLUGIN_DIR |
| 31 | Cloning into '.+?'\.\.\. (re) | 31 | Cloning into '.+?'\.\.\. (re) |
| 32 | done. | 32 | done. |
| 33 | $ hehe | 33 | $ hehe |
| 34 | hehe | 34 | hehe |
| 35 | 35 |
tests/update.t
| 1 | Load plugin from master. | 1 | Load plugin from master. |
| 2 | 2 | ||
| 3 | $ antigen-bundle $PWD/test-plugin | 3 | $ antigen-bundle $PLUGIN_DIR |
| 4 | Cloning into '.+?'\.\.\. (re) | 4 | Cloning into '.+?'\.\.\. (re) |
| 5 | done. | 5 | done. |
| 6 | $ hehe | 6 | $ hehe |
| 7 | hehe | 7 | hehe |
| 8 | 8 | ||
| 9 | Update the plugin. | 9 | Update the plugin. |
| 10 | 10 | ||
| 11 | $ cat > test-plugin/aliases.zsh <<EOF | 11 | $ cat > $PLUGIN_DIR/aliases.zsh <<EOF |
| 12 | > alias hehe='echo hehe, updated' | 12 | > alias hehe='echo hehe, updated' |
| 13 | > EOF | 13 | > EOF |
| 14 | $ pg commit -am 'Updated message' | 14 | $ pg commit -am 'Updated message' |
| 15 | \[master [a-f0-9]{7}\] Updated message (re) | 15 | \[master [a-f0-9]{7}\] Updated message (re) |
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 17 | 17 | ||
| 18 | Update bundles. | 18 | Update bundles. |
| 19 | 19 | ||
| 20 | $ antigen-update | 20 | $ antigen-update |
| 21 | From .+?/test-plugin (re) | 21 | From \S+? (re) |
| 22 | [a-z0-9]{7}\.\.[a-z0-9]{7} master -> origin/master (re) | 22 | [a-z0-9]{7}\.\.[a-z0-9]{7} master -> origin/master (re) |
| 23 | Updating [a-z0-9]{7}\.\.[a-z0-9]{7} (re) | 23 | Updating [a-z0-9]{7}\.\.[a-z0-9]{7} (re) |
| 24 | Fast-forward | 24 | Fast-forward |
| 25 | aliases.zsh | 2 +- | 25 | aliases.zsh | 2 +- |
| 26 | 1 file changed, 1 insertion(+), 1 deletion(-) | 26 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 27 | 27 | ||
| 28 | Confirm there is still only one repository. | 28 | Confirm there is still only one repository. |
| 29 | 29 | ||
| 30 | $ ls $ADOTDIR/repos | wc -l | 30 | $ ls $ADOTDIR/repos | wc -l |
| 31 | 1 | 31 | 1 |
| 32 | 32 | ||
| 33 | The new alias should not activate. | 33 | The new alias should not activate. |
| 34 | 34 | ||
| 35 | $ hehe | 35 | $ hehe |
| 36 | hehe | 36 | hehe |
| 37 | 37 |