diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-10 22:34:25 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-10 22:34:25 +0200 |
commit | 34badfbe0285e92d4f1fcedca2455e6fc1f3eb3e (patch) | |
tree | b08c18ec5cf7d6d7abe8162f9cb75bb628738fdc | |
parent | e523c110b4f9c9703ecf7694d551a439983bf7ba (diff) |
Added tests for pkg list
-rwxr-xr-x | test/main | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -1,6 +1,10 @@ #!/usr/bin/env zsh setopt err_exit +function stringcmp { + diff -u <(echo $1) <(echo $2) +} + test_pdir=$(mktemp -dt pkgdir.XXXXXX) test_proot=$(mktemp -dt pkgroot.XXXXXX) test_home=$(mktemp -dt pkghome.XXXXXX) @@ -16,6 +20,14 @@ echo "# setting up PKG_ROOT" cd $test_proot git clone ${1-git://git.tabularazor.org/~derf/pkg} core cp core/include/pkglist pkglist +for repo in ra rb rc; ( + mkdir $repo + cd $repo + git init + touch foo + git add foo + git commit -m 'initial commit' +) echo "# bootstrapping PDIR" cd $test_home @@ -27,6 +39,16 @@ echo "# checking for success" [[ -d $test_proot/core ]] [[ -d $test_pdir/core ]] +echo "# pkg list local" +stringcmp "core" $(pkg list) +stringcmp "core" $(pkg list local) + +echo "# pkg list not-installed" +stringcmp "ra\nrb\nrc" "$(pkg list not-installed)" + +echo "# pkg list all" +stringcmp "core\nra\nrb\nrc" "$(pkg list all)" + rm -rf $test_pdir $test_proot $test_home print -P '%F{green} test passed%F{default}' |