diff options
author | merakor <cem@ckyln.com> | 2021-01-06 12:01:50 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-01-06 12:01:50 +0000 |
commit | e4520245639f46fd02efbc9af2457de9cd1099e2 (patch) | |
tree | f1459f35123abcb573051f2a87990668b3cd6b45 /spec/02_src_spec.sh | |
parent | e31f8c482bacb62014fa0f1a35d9044bb6823147 (diff) | |
parent | ae42d4a74240d452864cdf16ce2ac2cbbdb5fc68 (diff) | |
download | cpt-e4520245639f46fd02efbc9af2457de9cd1099e2.tar.gz |
Merge branch 'shellspec' into experiment/lazyload
FossilOrigin-Name: 5ba55e426ac6b4ca55ac87abacdd7cff99f8c96ee24e53018734295c199db585
Diffstat (limited to 'spec/02_src_spec.sh')
-rw-r--r-- | spec/02_src_spec.sh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/spec/02_src_spec.sh b/spec/02_src_spec.sh index b97fe3c..b4a5c48 100644 --- a/spec/02_src_spec.sh +++ b/spec/02_src_spec.sh @@ -2,7 +2,7 @@ Describe 'Main toolchain' export PATH=$PWD/src:$PATH export CPT_ROOT=$PWD/tests export CPT_PATH=$PWD/tests/repository - install_dummy() { CPT_HOOK='' ./src/cpt bi dummy-pkg ;} + install_dummy() { CPT_HOOK='' ./src/cpt bi dummy-pkg >/dev/null 2>&1 ;} remove_dummy() { rm -rf "${CPT_ROOT:?}/var" ;} BeforeAll install_dummy AfterAll remove_dummy @@ -67,17 +67,14 @@ Describe 'Main toolchain' Describe 'cpt-list' no_db_dir() { - # Return 0 if database directory is empty (or doesn't exist) - # shellcheck disable=2012 - count=$(ls -1 "$CPT_ROOT/var/db/cpt/installed" 2>/dev/null | wc -l) - [ "$count" -eq 0 ] + [ "$(pkgnum)" -eq 0 ] } Skip if "there are no installed packages" no_db_dir It 'lists all packages when called without arguments' When run script src/cpt-list - The lines of output should eq "$(ls -1 "$CPT_ROOT/var/db/cpt/installed" 2>/dev/null | wc -l)" + The lines of output should eq "$(pkgnum)" End - for firstpkg in "$CPT_ROOT/var/db/cpt/installed/"*; do firstpkg=${firstpkg##*/}; break; done + firstpkg=$(getfirstpkg) It 'only lists the packages given in the arguments' When run script src/cpt-list "$firstpkg" The word 1 of stdout should eq "$firstpkg" |