Commit e97637cd0fe79659a99fd0a466f5adba4e985e6f

Authored by Shrikant Sharat
1 parent e0d9ad45ab

Moved common code for creating test plugin repo.

Showing 3 changed files with 25 additions and 58 deletions Side-by-side Diff

... ... @@ -14,3 +14,22 @@ export ADOTDIR="$PWD/dot-antigen"
14 14 rm "$TESTDIR/.zcompdump"
15 15  
16 16 source "$TESTDIR/../antigen.zsh"
  17 +
  18 +# A test plugin repository to test out antigen with.
  19 +
  20 +mkdir test-plugin
  21 +
  22 +# A wrapper function over `git` to work with the test plugin repo.
  23 +pg () {
  24 + git --git-dir test-plugin/.git --work-tree test-plugin "$@"
  25 +}
  26 +
  27 +cat > test-plugin/aliases.zsh <<EOF
  28 +alias hehe='echo hehe'
  29 +EOF
  30 +
  31 +{
  32 + pg init
  33 + pg add .
  34 + pg commit -m 'Initial commit'
  35 +} > /dev/null
tests/branch-bundle.t
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   -Master branch content.
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 1 Branch b1.
28 2  
29 3 $ pg branch b1
30 4 $ pg checkout b1
31 5 Switched to branch 'b1'
32   - $ cat > plugin/aliases.zsh <<EOF
  6 + $ cat > test-plugin/aliases.zsh <<EOF
33 7 > alias hehe='echo hehe from b1'
34 8 > EOF
35 9 $ pg commit -am 'Change for b1'
... ... @@ -43,7 +17,7 @@ Go back to master.
43 17  
44 18 Load plugin from b1.
45 19  
46   - $ antigen-bundle $PWD/plugin --branch=b1
  20 + $ antigen-bundle $PWD/test-plugin --branch=b1
47 21 Cloning into '.+?'\.\.\. (re)
48 22 done.
49 23 Switched to a new branch 'b1'
... ... @@ -53,7 +27,7 @@ Load plugin from b1.
53 27  
54 28 Load plugin from master.
55 29  
56   - $ antigen-bundle $PWD/plugin
  30 + $ antigen-bundle $PWD/test-plugin
57 31 Cloning into '.+?'\.\.\. (re)
58 32 done.
59 33 $ hehe
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 1 Load plugin from master.
28 2  
29   - $ antigen-bundle $PWD/plugin
  3 + $ antigen-bundle $PWD/test-plugin
30 4 Cloning into '.+?'\.\.\. (re)
31 5 done.
32 6 $ hehe
... ... @@ -34,7 +8,7 @@ Load plugin from master.
34 8  
35 9 Update the plugin.
36 10  
37   - $ cat > plugin/aliases.zsh <<EOF
  11 + $ cat > test-plugin/aliases.zsh <<EOF
38 12 > alias hehe='echo hehe, updated'
39 13 > EOF
40 14 $ pg commit -am 'Updated message'
... ... @@ -44,7 +18,7 @@ Update the plugin.
44 18 Update bundles.
45 19  
46 20 $ antigen-update
47   - From .+?/plugin (re)
  21 + From .+?/test-plugin (re)
48 22 [a-z0-9]{7}\.\.[a-z0-9]{7} master -> origin/master (re)
49 23 Updating [a-z0-9]{7}\.\.[a-z0-9]{7} (re)
50 24 Fast-forward