xref: /freebsd/usr.bin/pr/tests/basic2_test.sh (revision 809a8352dd5bb83dca991ff6c82e509208afad26)
1*809a8352SAlan Somers# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2*809a8352SAlan Somers#
36dc025eaSAlan Somers# Copyright (c) 2017 Alan Somers
46dc025eaSAlan Somers#
56dc025eaSAlan Somers# Redistribution and use in source and binary forms, with or without
66dc025eaSAlan Somers# modification, are permitted provided that the following conditions
76dc025eaSAlan Somers# are met:
86dc025eaSAlan Somers# 1. Redistributions of source code must retain the above copyright
96dc025eaSAlan Somers#    notice, this list of conditions and the following disclaimer.
106dc025eaSAlan Somers# 2. Redistributions in binary form must reproduce the above copyright
116dc025eaSAlan Somers#    notice, this list of conditions and the following disclaimer in the
126dc025eaSAlan Somers#    documentation and/or other materials provided with the distribution.
136dc025eaSAlan Somers#
146dc025eaSAlan Somers# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
156dc025eaSAlan Somers# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
166dc025eaSAlan Somers# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
176dc025eaSAlan Somers# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
186dc025eaSAlan Somers# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
196dc025eaSAlan Somers# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
206dc025eaSAlan Somers# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
216dc025eaSAlan Somers# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
226dc025eaSAlan Somers# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
236dc025eaSAlan Somers# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
246dc025eaSAlan Somers# POSSIBILITY OF SUCH DAMAGE.
256dc025eaSAlan Somers#
266dc025eaSAlan Somers# $FreeBSD$
276dc025eaSAlan Somers
286dc025eaSAlan Somersatf_test_case across
296dc025eaSAlan Somersacross_head() {
306dc025eaSAlan Somers        atf_set "descr" "Format columns in round-robin order with pr -a"
316dc025eaSAlan Somers}
326dc025eaSAlan Somersacross_body() {
336dc025eaSAlan Somers	atf_check -s exit:0 -o file:$(atf_get_srcdir)/across.out \
346dc025eaSAlan Somers		-x "pr -t -a -2 $(atf_get_srcdir)/other.in"
356dc025eaSAlan Somers}
366dc025eaSAlan Somers
376dc025eaSAlan Somersatf_test_case merge
386dc025eaSAlan Somersmerge_head() {
396dc025eaSAlan Somers        atf_set "descr" "Merge two files with pr -m"
406dc025eaSAlan Somers}
416dc025eaSAlan Somersmerge_body() {
426dc025eaSAlan Somers	atf_check -s ignore -o file:$(atf_get_srcdir)/merge.out \
436dc025eaSAlan Somers		pr -t -m $(atf_get_srcdir)/d_basic.in $(atf_get_srcdir)/other.in
446dc025eaSAlan Somers}
456dc025eaSAlan Somers
466dc025eaSAlan Somersatf_test_case threecol
476dc025eaSAlan Somersthreecol_head() {
486dc025eaSAlan Somers        atf_set "descr" "Format a file with three columns"
496dc025eaSAlan Somers}
506dc025eaSAlan Somersthreecol_body() {
516dc025eaSAlan Somers	atf_check -s ignore -o file:$(atf_get_srcdir)/threecol.out \
526dc025eaSAlan Somers		pr -t -3 $(atf_get_srcdir)/other.in
536dc025eaSAlan Somers}
546dc025eaSAlan Somers
556dc025eaSAlan Somersatf_init_test_cases()
566dc025eaSAlan Somers{
576dc025eaSAlan Somers        atf_add_test_case across
586dc025eaSAlan Somers        atf_add_test_case merge
596dc025eaSAlan Somers        atf_add_test_case threecol
606dc025eaSAlan Somers}
61