xref: /freebsd/usr.bin/pr/tests/basic2_test.sh (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1*4d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause
2809a8352SAlan 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
276dc025eaSAlan Somersatf_test_case across
286dc025eaSAlan Somersacross_head() {
296dc025eaSAlan Somers        atf_set "descr" "Format columns in round-robin order with pr -a"
306dc025eaSAlan Somers}
316dc025eaSAlan Somersacross_body() {
326dc025eaSAlan Somers	atf_check -s exit:0 -o file:$(atf_get_srcdir)/across.out \
336dc025eaSAlan Somers		-x "pr -t -a -2 $(atf_get_srcdir)/other.in"
346dc025eaSAlan Somers}
356dc025eaSAlan Somers
366dc025eaSAlan Somersatf_test_case merge
376dc025eaSAlan Somersmerge_head() {
386dc025eaSAlan Somers        atf_set "descr" "Merge two files with pr -m"
396dc025eaSAlan Somers}
406dc025eaSAlan Somersmerge_body() {
416dc025eaSAlan Somers	atf_check -s ignore -o file:$(atf_get_srcdir)/merge.out \
426dc025eaSAlan Somers		pr -t -m $(atf_get_srcdir)/d_basic.in $(atf_get_srcdir)/other.in
436dc025eaSAlan Somers}
446dc025eaSAlan Somers
456dc025eaSAlan Somersatf_test_case threecol
466dc025eaSAlan Somersthreecol_head() {
476dc025eaSAlan Somers        atf_set "descr" "Format a file with three columns"
486dc025eaSAlan Somers}
496dc025eaSAlan Somersthreecol_body() {
506dc025eaSAlan Somers	atf_check -s ignore -o file:$(atf_get_srcdir)/threecol.out \
516dc025eaSAlan Somers		pr -t -3 $(atf_get_srcdir)/other.in
526dc025eaSAlan Somers}
536dc025eaSAlan Somers
546dc025eaSAlan Somersatf_init_test_cases()
556dc025eaSAlan Somers{
566dc025eaSAlan Somers        atf_add_test_case across
576dc025eaSAlan Somers        atf_add_test_case merge
586dc025eaSAlan Somers        atf_add_test_case threecol
596dc025eaSAlan Somers}
60