From 1080f6b06c16f21bd3f47923fb26f36a55b44899 Mon Sep 17 00:00:00 2001 From: merakor Date: Thu, 4 Feb 2021 09:09:01 +0000 Subject: specs: update FossilOrigin-Name: c8b7e2be6108720ed5ec3944dda624d0c28cda5ed5fb5b20908a86f76da33da8 --- spec/02_src_spec.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'spec/02_src_spec.sh') 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 -- cgit v1.2.3