aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-02-23 13:41:07 +0000
committermerakor <cem@ckyln.com>2021-02-23 13:41:07 +0000
commitc385c7fbb2f006cb1f5b862ac9565b479e24d4de (patch)
treea1810a7774848191fb7edc03d435a0dbbb7a23f6
parent5a9bd4ebbde9f250633455505816e0cea8289e30 (diff)
downloadcpt-c385c7fbb2f006cb1f5b862ac9565b479e24d4de.tar.gz
spec: update unit tests
FossilOrigin-Name: eede5e5811b54004a94339e5fd5397021d0aca2085c244ff2693bfd0bbc4a5c5
-rw-r--r--spec/01_lib_spec.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/01_lib_spec.sh b/spec/01_lib_spec.sh
index 9e8ab36..62591a7 100644
--- a/spec/01_lib_spec.sh
+++ b/spec/01_lib_spec.sh
@@ -1,4 +1,4 @@
-# shellcheck disable=2091
+# shellcheck disable=2091,2034
Describe 'CPT Library'
export CPT_COLOR=0
@@ -110,14 +110,14 @@ Describe 'CPT Library'
End
Describe '_readlinkf()'
- mklink() { :> testfile; ln -s testfile testfile2 ;}
- rmlink() { rm -f testfile testfile2 ;}
+ mklink() { :> tests/testfile; ln -s testfile tests/testfile2 ;}
+ rmlink() { rm -f tests/testfile tests/testfile2 ;}
RPWD=$(cd -P .||:; printf %s "$PWD")
Before mklink
After rmlink
Parameters
"#1" . "$RPWD"
- "#2" "$PWD/testfile2" "$RPWD/testfile"
+ "#2" "$PWD/tests/testfile2" "$RPWD/tests/testfile"
End
It "outputs the real location of the given file ($1)"
When call _readlinkf "$2"
@@ -126,7 +126,7 @@ Describe 'CPT Library'
End
Describe 'sh256()'
- It 'outputs an sha256 digest of the given file'
+ It 'outputs an sha256 digest of the given file using any valid system tool'
# This should cover our bases for a long time.
When call sh256 .editorconfig
The output should eq "da42265df733ca05a08d77405c35aa3dd5b8b7fefcc2da915f508067a49351da .editorconfig"
@@ -197,5 +197,13 @@ Describe 'CPT Library'
The variable mak_dir should be undefined
End
End
+ Describe 'pkg_get_base()'
+ CPT_ROOT=$PWD/tests
+ CPT_PATH=$PWD/tests/repository
+ It 'returns packages defined in base'
+ When call pkg_get_base nonl
+ The output should eq "dummy-pkg contrib-dummy-pkg "
+ End
+ End
End
End