Commit e0d9ad45abc3159cd421b6f8662de30cabab6353

Authored by Shrikant Sharat
1 parent 8d0d219d6f

Fix #9 Add test for antigen-update command.

Showing 3 changed files with 65 additions and 2 deletions Side-by-side Diff

1 1 .PHONY: tests
2 2  
3 3 tests:
4   - ZDOTDIR="${PWD}/tests" cram -i --shell=zsh tests/branch-bundle.t
  4 + ZDOTDIR="${PWD}/tests" cram -i --shell=zsh tests/branch-bundle.t \
  5 + tests/update.t
... ... @@ -9,7 +9,7 @@ if [[ ! -d "$default_clone" ]]; then
9 9 fi
10 10  
11 11 export ANTIGEN_DEFAULT_REPO_URL="$default_clone"
12   -export ADOTDIR="$TMP/dot-antigen"
  12 +export ADOTDIR="$PWD/dot-antigen"
13 13  
14 14 rm "$TESTDIR/.zcompdump"
15 15  
... ... @@ -0,0 +1,62 @@
  1 +Setup a plugin.
  2 +
  3 + $ mkdir plugin
  4 +
  5 +A git wrapper that works with the plugin's repo.
  6 +
  7 + $ pg () {
  8 + > git --git-dir plugin/.git --work-tree plugin "$@"
  9 + > }
  10 +
  11 +Setup the plugin repo.
  12 +
  13 + $ pg init
  14 + Initialized empty Git repository in .+?/plugin/\.git/? (re)
  15 +
  16 +Write to the plugin.
  17 +
  18 + $ cat > plugin/aliases.zsh <<EOF
  19 + > alias hehe='echo hehe'
  20 + > EOF
  21 + $ pg add .
  22 + $ pg commit -m 'Initial commit'
  23 + \[master \(root-commit\) [a-f0-9]{7}\] Initial commit (re)
  24 + 1 file changed, 1 insertion(+)
  25 + create mode [\d]{6} aliases\.zsh (re)
  26 +
  27 +Load plugin from master.
  28 +
  29 + $ antigen-bundle $PWD/plugin
  30 + Cloning into '.+?'\.\.\. (re)
  31 + done.
  32 + $ hehe
  33 + hehe
  34 +
  35 +Update the plugin.
  36 +
  37 + $ cat > plugin/aliases.zsh <<EOF
  38 + > alias hehe='echo hehe, updated'
  39 + > EOF
  40 + $ pg commit -am 'Updated message'
  41 + \[master [a-f0-9]{7}\] Updated message (re)
  42 + 1 file changed, 1 insertion(+), 1 deletion(-)
  43 +
  44 +Update bundles.
  45 +
  46 + $ antigen-update
  47 + From .+?/plugin (re)
  48 + [a-z0-9]{7}\.\.[a-z0-9]{7} master -> origin/master (re)
  49 + Updating [a-z0-9]{7}\.\.[a-z0-9]{7} (re)
  50 + Fast-forward
  51 + aliases.zsh | 2 +-
  52 + 1 file changed, 1 insertion(+), 1 deletion(-)
  53 +
  54 +Confirm there is still only one repository.
  55 +
  56 + $ ls $ADOTDIR/repos | wc -l
  57 + 1
  58 +
  59 +The new alias should not activate.
  60 +
  61 + $ hehe
  62 + hehe