1*60dc3e4dSnjoly# $NetBSD: t_basic.sh,v 1.6 2012/10/15 17:49:58 njoly Exp $ 21f57069fSjruoho# 31f57069fSjruoho# Copyright (c) 2011 The NetBSD Foundation, Inc. 41f57069fSjruoho# All rights reserved. 51f57069fSjruoho# 61f57069fSjruoho# This code is derived from software contributed to The NetBSD Foundation 71f57069fSjruoho# by Jukka Ruohonen. 81f57069fSjruoho# 91f57069fSjruoho# Redistribution and use in source and binary forms, with or without 101f57069fSjruoho# modification, are permitted provided that the following conditions 111f57069fSjruoho# are met: 121f57069fSjruoho# 1. Redistributions of source code must retain the above copyright 131f57069fSjruoho# notice, this list of conditions and the following disclaimer. 141f57069fSjruoho# 2. Redistributions in binary form must reproduce the above copyright 151f57069fSjruoho# notice, this list of conditions and the following disclaimer in the 161f57069fSjruoho# documentation and/or other materials provided with the distribution. 171f57069fSjruoho# 181f57069fSjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 191f57069fSjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 201f57069fSjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 211f57069fSjruoho# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 221f57069fSjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 231f57069fSjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 241f57069fSjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 251f57069fSjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 261f57069fSjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 271f57069fSjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 281f57069fSjruoho# POSSIBILITY OF SUCH DAMAGE. 291f57069fSjruoho# 301f57069fSjruoho 311f57069fSjruohoatf_test_case basic 321a3a1673Sjruohobasic_head() { 33543143cfSjruoho atf_set "descr" "A basic test of unifdef(1) (PR bin/42628)" 347605f649Snjoly atf_set "require.progs" "unifdef" 351f57069fSjruoho} 361f57069fSjruoho 371f57069fSjruohobasic_body() { 381f57069fSjruoho 391f57069fSjruoho atf_check -s ignore -o file:$(atf_get_srcdir)/d_basic.out \ 401f57069fSjruoho -x "unifdef -U__FreeBSD__ $(atf_get_srcdir)/d_basic.in" 411f57069fSjruoho} 421f57069fSjruoho 43*60dc3e4dSnjolyatf_test_case lastline 44*60dc3e4dSnjolylastline_head() { 45*60dc3e4dSnjoly atf_set "descr" "Checks with directive on last line (PR bin/47068)" 46*60dc3e4dSnjoly} 47*60dc3e4dSnjoly 48*60dc3e4dSnjolylastline_body() { 49*60dc3e4dSnjoly 50*60dc3e4dSnjoly # With newline after cpp directive 51*60dc3e4dSnjoly printf '#ifdef foo\n#endif\n' >input 52*60dc3e4dSnjoly atf_check -o file:input unifdef -Ubar input 53*60dc3e4dSnjoly 54*60dc3e4dSnjoly # Without newline after cpp directive 55*60dc3e4dSnjoly printf '#ifdef foo\n#endif' >input 56*60dc3e4dSnjoly atf_check -o file:input unifdef -Ubar input 57*60dc3e4dSnjoly} 58*60dc3e4dSnjoly 591f57069fSjruohoatf_init_test_cases() { 601f57069fSjruoho atf_add_test_case basic 61*60dc3e4dSnjoly atf_add_test_case lastline 621f57069fSjruoho} 63