Skip to content

Commit da48bce

Browse files
classabbyampChocimier
authored andcommitted
tests: add test case for replaces
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
1 parent 86104ff commit da48bce

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/xbps/libxbps/shell/replace_test.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,32 @@ replace_automatically_installed_dep3_body() {
613613
atf_check_equal $(xbps-query -C xbps.d -r root -p automatic-install B) "yes"
614614
}
615615

616+
atf_test_case dont_replace_alternative_pkg_during_install
617+
618+
dont_replace_alternative_pkg_during_install_head() {
619+
atf_set "descr" "Tests for package replace: install a package that has a pair replacing each other"
620+
}
621+
622+
dont_replace_alternative_pkg_during_install_body() {
623+
mkdir some_repo root
624+
mkdir -p pkg_A/usr/bin empty
625+
echo "A-1.0_1" > pkg_A/usr/bin/foo
626+
cd some_repo
627+
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --replaces "B>=0" ../pkg_A
628+
atf_check_equal $? 0
629+
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --replaces "A>=0" ../pkg_A
630+
atf_check_equal $? 0
631+
xbps-rindex -d -a $PWD/*.xbps
632+
atf_check_equal $? 0
633+
cd ..
634+
xbps-install -C xbps.d -r root --repository=$PWD/some_repo -yd B
635+
atf_check_equal $? 0
636+
result=$(xbps-query -r root -l | wc -l)
637+
atf_check_equal $result 1
638+
atf_check_equal $(xbps-query -C xbps.d -r root -p state A) ""
639+
atf_check_equal $(xbps-query -C xbps.d -r root -p state B) installed
640+
}
641+
616642
atf_init_test_cases() {
617643
atf_add_test_case replace_dups
618644
atf_add_test_case replace_ntimes
@@ -630,4 +656,5 @@ atf_init_test_cases() {
630656
atf_add_test_case replace_automatically_installed_dep
631657
atf_add_test_case replace_automatically_installed_dep2
632658
atf_add_test_case replace_automatically_installed_dep3
659+
atf_add_test_case dont_replace_alternative_pkg_during_install
633660
}

0 commit comments

Comments
 (0)