bin/xbps-rindex: add unit tests to test rindex behavior for adding packages with reverts.

This commit is contained in:
Enno Boland 2014-09-23 19:17:31 +02:00
parent 78203c1735
commit 4467518329

View File

@ -30,6 +30,33 @@ update_body() {
atf_check_equal $rv 0 atf_check_equal $rv 0
} }
revert_head() {
atf_set "descr" "xbps-rindex(8) -a: revert version test"
}
revert_body() {
mkdir -p some_repo pkg_A
touch pkg_A/file00
cd some_repo
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
xbps-create -A noarch -n foo-1.0_1 -r "1.1_1" -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
result="$(xbps-query -r root -C empty.conf --repository=some_repo -o \*)"
expected="foo-1.0_1: /file00 (some_repo)"
rv=0
if [ "$result" != "$expected" ]; then
rv=1
fi
atf_check_equal $rv 0
}
atf_init_test_cases() { atf_init_test_cases() {
atf_add_test_case update atf_add_test_case update
atf_add_test_case revert
} }