aboutsummaryrefslogtreecommitdiff
path: root/spec/03_contrib_spec.sh
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-02-04 09:09:01 +0000
committermerakor <cem@ckyln.com>2021-02-04 09:09:01 +0000
commit1080f6b06c16f21bd3f47923fb26f36a55b44899 (patch)
treead02e9b67bad1f0400405a68b683207fd83031d4 /spec/03_contrib_spec.sh
parentf72d7864674b7f9e25541354ad1f0779e3ce27ef (diff)
downloadcpt-1080f6b06c16f21bd3f47923fb26f36a55b44899.tar.gz
specs: update
FossilOrigin-Name: c8b7e2be6108720ed5ec3944dda624d0c28cda5ed5fb5b20908a86f76da33da8
Diffstat (limited to 'spec/03_contrib_spec.sh')
-rw-r--r--spec/03_contrib_spec.sh42
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/03_contrib_spec.sh b/spec/03_contrib_spec.sh
index a3fce8e..9c7589b 100644
--- a/spec/03_contrib_spec.sh
+++ b/spec/03_contrib_spec.sh
@@ -72,11 +72,51 @@ Describe 'contrib scripts'
End
End
Describe 'cpt-export'
+ chtmp() { cd "$CPT_ROOT/tmp" || return 1 ;}
+ cleanpkg() { rm -f "$CPT_PATH/contrib-dummy-pkg/contrib-dummy-pkg#1-1.tar.gz" ;}
+ Before chtmp
+ AfterAll cleanpkg
firstpkg=$(getfirstpkg)
It "exports a tarball of the given package"
- cd "$CPT_ROOT/tmp" || return 1
When run script "$(command -v cpt-export)" contrib-dummy-pkg
The stdout should eq "tarball created in $CPT_ROOT/tmp/contrib-dummy-pkg#1-1.tar.gz"
End
+ It "exports the package of the current directory when called without arguments"
+ cd "$CPT_PATH/contrib-dummy-pkg" || return 1
+ When run script "$(command -v cpt-export)"
+ The stdout should eq "tarball created in $CPT_PATH/contrib-dummy-pkg/contrib-dummy-pkg#1-1.tar.gz"
+ End
+ It "prints usage information when called with --help"
+ When run script "$(command -v cpt-export)" --help
+ The word 1 of stdout should eq usage:
+ End
+ It "fallbacks to gz when CPT_COMPRESS has a typo"
+ export CPT_COMPRESS=typo
+ When run script "$(command -v cpt-export)" contrib-dummy-pkg
+ The stdout should eq "tarball created in $CPT_ROOT/tmp/contrib-dummy-pkg#1-1.tar.gz"
+ End
+ Parameters
+ bz2 bzip2
+ gz gzip
+ xz xz
+ zst zstd
+ End
+ Mock bzip2
+ cat
+ End
+ Mock gzip
+ cat
+ End
+ Mock xz
+ cat
+ End
+ Mock zstd
+ cat
+ End
+ It "uses the given CPT_COMPRESS value ($1)"
+ export "CPT_COMPRESS=$1"
+ When run script "$(command -v cpt-export)" contrib-dummy-pkg
+ The stdout should eq "tarball created in $CPT_ROOT/tmp/contrib-dummy-pkg#1-1.tar.$1"
+ End
End
End