Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Actually do the tests
Baptiste Daroussin committed 11 years ago
commit 918c5a7d9a12f7cd069507977d826334c5a2d65d
parent 93f416e
1 file changed +110 -0
added tests/frontend/set.shin
@@ -0,0 +1,110 @@
+
#! /usr/bin/env atf-sh
+

+
initialize_pkg() {
+
	export INSTALL_AS_USER=yes
+
	export PKG_DBDIR=.
+

+
	jailed=$(sysctl -n security.jail.jailed || :)
+
	if [ "$jailed" = "1" ]; then
+
		JAILED="[`hostname`] "
+
	fi
+
	cat << EOF > test.ucl
+
name: test
+
origin: origin/test
+
version: 1
+
maintainer: test
+
categories: [test]
+
comment: a test
+
www: http://test
+
prefix: /
+
abi = "*";
+
desc: <<EOD
+
Yet another test
+
EOD
+
EOF
+

+
	atf_check \
+
		-o match:".*Installing.*\.\.\.$" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg register -t -M test.ucl
+
}
+

+
atf_test_case set_automatic
+
set_automatic_body() {
+
	export INSTALL_AS_USER=yes
+

+
	initialize_pkg
+

+
	atf_check \
+
		-o inline:"0\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg query "%a" test
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg set -y -A 1 test
+

+
	atf_check \
+
		-o inline:"1\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg query "%a" test
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg set -y -A 0 test
+

+
	atf_check \
+
		-o inline:"0\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg query "%a" test
+
}
+

+
atf_test_case set_change_name
+
set_change_name_body() {
+
	initialize_pkg
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg set -yn test:new
+

+
	atf_check \
+
		-o inline:"new-1\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg info -q
+
}
+

+
atf_test_case set_change_origin
+
set_change_origin_body() {
+
	initialize_pkg
+

+
	atf_check \
+
		-o empty \
+
		-e empty \
+
		-s exit:0 \
+
		pkg set -yo origin/test:neworigin/test
+

+
	atf_check \
+
		-o inline:"neworigin/test\n" \
+
		-e empty \
+
		-s exit:0 \
+
		pkg info -qo
+
}
+

+
atf_init_test_cases() {
+
	. $(atf_get_srcdir)/test_environment.sh
+

+
	atf_add_test_case set_automatic
+
	atf_add_test_case set_change_name
+
	atf_add_test_case set_change_origin
+
}