commit 48b6807c98dcde2d06167261495e38a6bc7b1f28
parent 32d39660179c8519a5442afc404fcc62680d07c3
Author: Cem Keylan <cem@ckyln.com>
Date: Tue, 23 Feb 2021 16:41:07 +0300
spec: update unit tests
Diffstat:
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git 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