pw_groupshow_test.sh revision 321163
191586Smarkm# $FreeBSD: stable/10/usr.sbin/pw/tests/pw_groupshow_test.sh 321163 2017-07-18 18:48:25Z ngie $ 291592Smarkm 391586Smarkm# Import helper functions 4126178Sjohan. $(atf_get_srcdir)/helper_functions.shin 591586Smarkm 691586Smarkmatf_test_case group_show_all 791586Smarkmgroup_show_all_body() { 8212512Simp populate_etc_skel 9212512Simp atf_check -o not-empty ${PW} groupshow -a 10212512Simp} 11217123Simp 12212512Simpatf_test_case group_show_gid 13212534Simpgroup_show_gid_body() { 14212534Simp populate_etc_skel 15212512Simp atf_check -o not-empty ${PW} groupshow -g 0 16212535Simp} 17212534Simp 18212534Simpatf_test_case group_show_name 19212512Simpgroup_show_name_body() { 20212535Simp populate_etc_skel 2191592Smarkm atf_check -o not-empty ${PW} groupshow wheel 2291586Smarkm} 2391592Smarkm 24atf_test_case group_show_nonexistent_gid 25group_show_nonexistent_gid_body() { 26 populate_etc_skel 27 28 nonexistent_gid=4242 29 no_such_name_msg="pw: unknown gid \`$nonexistent_gid'\n" 30 31 atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ 32 $nonexistent_gid 33 atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ 34 -g $nonexistent_gid 35} 36 37atf_test_case group_show_nonexistent_name 38group_show_nonexistent_name_body() { 39 populate_etc_skel 40 41 nonexistent_name=bogus 42 no_such_name_msg="pw: unknown group \`$nonexistent_name'\n" 43 44 atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ 45 $nonexistent_name 46 atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ 47 -n $nonexistent_name 48} 49 50atf_init_test_cases() { 51 atf_add_test_case group_show_all 52 atf_add_test_case group_show_gid 53 atf_add_test_case group_show_name 54 atf_add_test_case group_show_nonexistent_gid 55 atf_add_test_case group_show_nonexistent_name 56} 57