aboutsummaryrefslogtreecommitdiff
path: root/spec/02_src_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/02_src_spec.sh
parentf72d7864674b7f9e25541354ad1f0779e3ce27ef (diff)
downloadcpt-1080f6b06c16f21bd3f47923fb26f36a55b44899.tar.gz
specs: update
FossilOrigin-Name: c8b7e2be6108720ed5ec3944dda624d0c28cda5ed5fb5b20908a86f76da33da8
Diffstat (limited to 'spec/02_src_spec.sh')
-rw-r--r--spec/02_src_spec.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/02_src_spec.sh b/spec/02_src_spec.sh
index 561bfe5..c5584ec 100644
--- a/spec/02_src_spec.sh
+++ b/spec/02_src_spec.sh
@@ -93,4 +93,38 @@ Describe 'Main toolchain'
The output should eq "$2"
End
End
+ Describe 'cpt-search'
+ It "searches packages inside the \$CPT_PATH and the system database"
+ When run script src/cpt-search dummy-pkg
+ The line 1 of output should eq "$CPT_PATH/dummy-pkg"
+ The line 2 of output should eq "$CPT_ROOT/var/db/cpt/installed/dummy-pkg"
+ End
+ It "only shows the first instance of a package with the '-s' flag"
+ When run script src/cpt-search -s dummy-pkg
+ The output should eq "$CPT_PATH/dummy-pkg"
+ End
+ It "only shows the first instance of a package with the '--single' flag"
+ When run script src/cpt-search --single dummy-pkg
+ The output should eq "$CPT_PATH/dummy-pkg"
+ End
+ It "shows other locations of the package inside a package directory with the '-o' flag"
+ cd "$CPT_PATH/dummy-pkg" || return 1
+ When run script "$(command -v cpt-search)" -o
+ The output should eq "$CPT_ROOT/var/db/cpt/installed/dummy-pkg"
+ End
+ It "shows other locations of the package inside a package directory with the '--others' flag"
+ cd "$CPT_PATH/dummy-pkg" || return 1
+ When run script "$(command -v cpt-search)" --others
+ The output should eq "$CPT_ROOT/var/db/cpt/installed/dummy-pkg"
+ End
+ Parameters
+ 'd*'
+ 'd???y-?kg'
+ '[Dd][uU]*-?*g*'
+ End
+ It "accepts regular expressions"
+ When run script src/cpt-search -s "$1"
+ The output should eq "$CPT_PATH/dummy-pkg"
+ End
+ End
End