1323275Sasomers# 2323275Sasomers# Copyright 2017 Shivansh Rai 3323275Sasomers# All rights reserved. 4323275Sasomers# 5323275Sasomers# Redistribution and use in source and binary forms, with or without 6323275Sasomers# modification, are permitted provided that the following conditions 7323275Sasomers# are met: 8323275Sasomers# 1. Redistributions of source code must retain the above copyright 9323275Sasomers# notice, this list of conditions and the following disclaimer. 10323275Sasomers# 2. Redistributions in binary form must reproduce the above copyright 11323275Sasomers# notice, this list of conditions and the following disclaimer in the 12323275Sasomers# documentation and/or other materials provided with the distribution. 13323275Sasomers# 14323275Sasomers# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15323275Sasomers# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16323275Sasomers# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17323275Sasomers# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18323275Sasomers# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19323275Sasomers# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20323275Sasomers# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21323275Sasomers# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22323275Sasomers# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23323275Sasomers# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24323275Sasomers# SUCH DAMAGE. 25323275Sasomers# 26323275Sasomers# $FreeBSD: stable/11/bin/chflags/tests/chflags_test.sh 323275 2017-09-07 16:54:47Z asomers $ 27323275Sasomers# 28323275Sasomers 29323275Sasomersusage_output='usage: chflags' 30323275Sasomers 31323275Sasomersatf_test_case invalid_usage 32323275Sasomersinvalid_usage_head() 33323275Sasomers{ 34323275Sasomers atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message" 35323275Sasomers} 36323275Sasomers 37323275Sasomersinvalid_usage_body() 38323275Sasomers{ 39323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -f 40323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -H 41323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -h 42323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -L 43323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -P 44323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -R 45323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags -v 46323275Sasomers} 47323275Sasomers 48323275Sasomersatf_test_case no_arguments 49323275Sasomersno_arguments_head() 50323275Sasomers{ 51323275Sasomers atf_set "descr" "Verify that chflags(1) fails and generates a valid usage message when no arguments are supplied" 52323275Sasomers} 53323275Sasomers 54323275Sasomersno_arguments_body() 55323275Sasomers{ 56323275Sasomers atf_check -s not-exit:0 -e match:"$usage_output" chflags 57323275Sasomers} 58323275Sasomers 59323275Sasomersatf_init_test_cases() 60323275Sasomers{ 61323275Sasomers atf_add_test_case invalid_usage 62323275Sasomers atf_add_test_case no_arguments 63323275Sasomers} 64