aboutsummaryrefslogtreecommitdiff
path: root/spec/02_src_spec.sh
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-01-06 11:56:09 +0000
committermerakor <cem@ckyln.com>2021-01-06 11:56:09 +0000
commitae42d4a74240d452864cdf16ce2ac2cbbdb5fc68 (patch)
tree555426dbde9aec2f5c22154bd21b416f14151d05 /spec/02_src_spec.sh
parent12a4321bfdc98c3bf7b1440077c1a09c9f4e3eec (diff)
downloadcpt-ae42d4a74240d452864cdf16ce2ac2cbbdb5fc68.tar.gz
shellspec: add spec_helper
FossilOrigin-Name: df5c93b3f164a3826c97d1ca43924d44af1a5e156e2c4b2f0b8496c60b652868
Diffstat (limited to 'spec/02_src_spec.sh')
-rw-r--r--spec/02_src_spec.sh9
1 files changed, 3 insertions, 6 deletions
diff --git a/spec/02_src_spec.sh b/spec/02_src_spec.sh
index 57c248f..b4a5c48 100644
--- a/spec/02_src_spec.sh
+++ b/spec/02_src_spec.sh
@@ -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"