summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/add21
-rw-r--r--test/addremove48
-rwxr-xr-xtest/main14
-rw-r--r--test/push11
-rw-r--r--test/remove19
-rw-r--r--test/setup1
6 files changed, 65 insertions, 49 deletions
diff --git a/test/add b/test/add
new file mode 100644
index 0000000..9810ca4
--- /dev/null
+++ b/test/add
@@ -0,0 +1,21 @@
+## vim:ft=zsh
+echo "# pkg add (ok)"
+pkg add $repo
+[[ -e $test_pdir/$repo/foo ]]
+[[ -d $test_pdir/$repo/.git ]]
+
+echo "# pkg add (already installed)"
+! pkg add $repo
+
+echo "# populate_collected"
+[[ -L $test_home/bin/$file ]]
+[[ -x $(readlink $test_home/bin/$file) ]]
+[[ -e $test_pdir/.collected/man/man2/$file.2 ]]
+
+repeat 2 {
+ echo "# pkg list"
+ stringcmp "core\n$repo" "$(pkg list local)"
+ stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
+ stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
+ pkg update
+}
diff --git a/test/addremove b/test/addremove
deleted file mode 100644
index 23196e1..0000000
--- a/test/addremove
+++ /dev/null
@@ -1,48 +0,0 @@
-## vim:ft=zsh
-file=${repo%-*}
-if [[ $repo == *-bare ]] {
- echo "## bare repository"
- complement=$file
-} else {
- echo "## non-bare repository"
- complement=${repo}-bare
-}
-echo "# pkg add (ok)"
-pkg add $repo
-[[ -e $test_pdir/$repo/foo ]]
-[[ -d $test_pdir/$repo/.git ]]
-
-echo "# pkg add (already installed)"
-! pkg add $repo
-
-echo "# populate_collected"
-[[ -L $test_home/bin/$file ]]
-[[ -x $(readlink $test_home/bin/$file) ]]
-[[ -e $test_pdir/.collected/man/man2/$file.2 ]]
-
-repeat 2 {
- echo "# pkg list"
- stringcmp "core\n$repo" "$(pkg list local)"
- stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
- stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
- pkg update
-}
-
-echo "# pkg remove (not installed/nonexistent)"
-! pkg remove suckage
-! pkg remove rb
-
-echo "# pkg remove (ok)"
-pkg remove $repo
-
-echo "# genocide_collected (~/bin)"
-[[ ! -L $test_home/bin/$file ]]
-[[ ! -e $test_pdir/.collected/man/man2/$file.2 ]]
-
-repeat 2 {
- echo "# pkg list"
- stringcmp "core" "$(pkg list local)"
- stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
- stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
- pkg update
-}
diff --git a/test/main b/test/main
index 59bc5df..bf5df36 100755
--- a/test/main
+++ b/test/main
@@ -58,7 +58,19 @@ for conf_origin in 0 1; {
echo "## GIT_USE_ORIGIN=$conf_origin"
echo "GIT_USE_ORIGIN=$conf_origin" >> $test_home/.pkg.conf
for repo in ra ra-bare; {
- source $tests/addremove
+ file=${repo%-*}
+ if [[ $repo == *-bare ]] {
+ echo "## bare repository"
+ complement=$file
+ } else {
+ echo "## non-bare repository"
+ complement=${repo}-bare
+ }
+ source $tests/add
+ cd $test_pdir/$repo
+ source $tests/push
+ cd $test_pdir
+ source $tests/remove
}
}
diff --git a/test/push b/test/push
new file mode 100644
index 0000000..ff735e5
--- /dev/null
+++ b/test/push
@@ -0,0 +1,11 @@
+## vim:ft=zsh
+somefile=$RANDOM
+touch $somefile
+git add $somefile
+git commit -m $somefile
+pkg push
+if [[ $repo == *-bare ]] {
+ [[ $(git --git-dir=$test_proot/$repo log --pretty=oneline | head -1) == *$somefile ]]
+} else {
+ [[ $(git --git-dir=$test_proot/$repo/.git log --pretty=oneline | head -1) == *$somefile ]]
+}
diff --git a/test/remove b/test/remove
new file mode 100644
index 0000000..c22a4f3
--- /dev/null
+++ b/test/remove
@@ -0,0 +1,19 @@
+## vim:ft=zsh
+echo "# pkg remove (not installed/nonexistent)"
+! pkg remove suckage
+! pkg remove rb
+
+echo "# pkg remove (ok)"
+pkg remove $repo
+
+echo "# genocide_collected (~/bin)"
+[[ ! -L $test_home/bin/$file ]]
+[[ ! -e $test_pdir/.collected/man/man2/$file.2 ]]
+
+repeat 2 {
+ echo "# pkg list"
+ stringcmp "core" "$(pkg list local)"
+ stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)"
+ stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)"
+ pkg update
+}
diff --git a/test/setup b/test/setup
index ac82c31..e2cff79 100644
--- a/test/setup
+++ b/test/setup
@@ -7,6 +7,7 @@ for repo in ra rb rc; (
mkdir $repo
cd $repo
git init
+ git config receive.denyCurrentBranch ignore
touch foo
mkdir bin
touch bin/$repo