1*4ce8b53aSrillig# $NetBSD: t_cat.sh,v 1.4 2024/04/26 00:57:15 rillig Exp $ 2651e2c69Sjruoho# 3651e2c69Sjruoho# Copyright (c) 2012 The NetBSD Foundation, Inc. 4651e2c69Sjruoho# All rights reserved. 5651e2c69Sjruoho# 6651e2c69Sjruoho# This code is derived from software contributed to The NetBSD Foundation 7651e2c69Sjruoho# by Jukka Ruohonen. 8651e2c69Sjruoho# 9651e2c69Sjruoho# Redistribution and use in source and binary forms, with or without 10651e2c69Sjruoho# modification, are permitted provided that the following conditions 11651e2c69Sjruoho# are met: 12651e2c69Sjruoho# 1. Redistributions of source code must retain the above copyright 13651e2c69Sjruoho# notice, this list of conditions and the following disclaimer. 14651e2c69Sjruoho# 2. Redistributions in binary form must reproduce the above copyright 15651e2c69Sjruoho# notice, this list of conditions and the following disclaimer in the 16651e2c69Sjruoho# documentation and/or other materials provided with the distribution. 17651e2c69Sjruoho# 18651e2c69Sjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19651e2c69Sjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20651e2c69Sjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21651e2c69Sjruoho# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22651e2c69Sjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23651e2c69Sjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24651e2c69Sjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25651e2c69Sjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26651e2c69Sjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27651e2c69Sjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28651e2c69Sjruoho# POSSIBILITY OF SUCH DAMAGE. 29651e2c69Sjruoho# 30651e2c69Sjruoho 31651e2c69Sjruohoatf_test_case align 32651e2c69Sjruohoalign_head() { 33651e2c69Sjruoho atf_set "descr" "Test that cat(1) aligns the output" \ 34651e2c69Sjruoho "right with options '-be' (PR bin/4841)" 35651e2c69Sjruoho} 36651e2c69Sjruoho 37651e2c69Sjruohoalign_body() { 38651e2c69Sjruoho 39*4ce8b53aSrillig atf_check -o file:$(atf_get_srcdir)/d_align.out \ 40*4ce8b53aSrillig cat -be $(atf_get_srcdir)/d_align.in 41651e2c69Sjruoho} 42651e2c69Sjruoho 43651e2c69Sjruohoatf_test_case nonexistent 44651e2c69Sjruohononexistent_head() { 452e3d44b8Sjruoho atf_set "descr" "Test that cat(1) doesn't return zero exit" \ 46651e2c69Sjruoho "status for a nonexistent file (PR bin/3538)" 47651e2c69Sjruoho} 48651e2c69Sjruoho 49651e2c69Sjruohononexistent_body() { 50651e2c69Sjruoho 51*4ce8b53aSrillig atf_check -s not-exit:0 -e not-empty \ 52*4ce8b53aSrillig cat /some/name/that/does/not/exist 53651e2c69Sjruoho} 54651e2c69Sjruoho 5517a9d104Ssevanatf_test_case se_output 5617a9d104Ssevanse_output_head() { 5717a9d104Ssevan atf_set "descr" "Test that cat(1) prints a $ sign" \ 5817a9d104Ssevan "on blank lines with options '-se' (PR bin/51250)" 5917a9d104Ssevan} 6017a9d104Ssevan 6117a9d104Ssevanse_output_body() { 62*4ce8b53aSrillig atf_check -o file:$(atf_get_srcdir)/d_se_output.out \ 63*4ce8b53aSrillig cat -se $(atf_get_srcdir)/d_se_output.in 6417a9d104Ssevan} 6517a9d104Ssevan 66651e2c69Sjruohoatf_init_test_cases() 67651e2c69Sjruoho{ 68651e2c69Sjruoho atf_add_test_case align 69651e2c69Sjruoho atf_add_test_case nonexistent 7017a9d104Ssevan atf_add_test_case se_output 71651e2c69Sjruoho} 72