Skip to content

Commit 25e1998

Browse files
committed
tests: add xbps-query -s test
1 parent 53c3002 commit 25e1998

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/xbps/xbps-query/query_test.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,46 @@ repo_cat_file_body() {
3939
atf_check_equal "$res" "hello world!"
4040
}
4141

42+
search_head() {
43+
atf_set "descr" "xbps-query(1) --search"
44+
}
45+
46+
search_body() {
47+
mkdir -p root some_repo pkg_A pkg_B pkg_C
48+
49+
cd some_repo
50+
atf_check -o ignore -- xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
51+
atf_check -o ignore -- xbps-create -A noarch -n bar-1.0_1 -s "bar pkg" ../pkg_B
52+
atf_check -o ignore -- xbps-create -A noarch -n fizz-1.0_1 -s "fizz pkg" ../pkg_C
53+
atf_check -o ignore -- xbps-rindex -a $PWD/*.xbps
54+
cd ..
55+
56+
# regex error
57+
atf_check -e match:"ERROR: failed to compile regexp: \(:" -s exit:1 -- \
58+
xbps-query -r root --repository=some_repo --regex -s '('
59+
60+
# repo mode
61+
atf_check -o inline:"[-] foo-1.0_1 foo pkg\n" -- \
62+
xbps-query -r root --repository=some_repo -s foo
63+
atf_check -o inline:"[-] fizz-1.0_1 fizz pkg\n[-] foo-1.0_1 foo pkg\n" -- \
64+
xbps-query -r root --repository=some_repo -s f
65+
66+
atf_check -o ignore -- \
67+
xbps-install -r root --repository=some_repo -y foo
68+
69+
# repo mode + installed
70+
atf_check -o inline:"[*] foo-1.0_1 foo pkg\n" -- \
71+
xbps-query -r root --repository=some_repo -s foo
72+
atf_check -o inline:"[-] fizz-1.0_1 fizz pkg\n[*] foo-1.0_1 foo pkg\n" -- \
73+
xbps-query -r root --repository=some_repo -s f
74+
75+
# installed mode
76+
atf_check -o inline:"[*] foo-1.0_1 foo pkg\n" -- \
77+
xbps-query -r root -s foo
78+
}
79+
4280
atf_init_test_cases() {
4381
atf_add_test_case cat_file
4482
atf_add_test_case repo_cat_file
83+
atf_add_test_case search
4584
}

0 commit comments

Comments
 (0)