summaryrefslogtreecommitdiff
path: root/tests/tac
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-02-17 01:30:05 +0000
committerJim Meyering <jim@meyering.net>1997-02-17 01:30:05 +0000
commit0d457a806390379c51b2496ff596ab23a01aac8c (patch)
tree705268981eb5a0718adb3aad03b6fdc8fafa5b05 /tests/tac
parent5db942f46c5fcc52c698c56376833b3a0927f53d (diff)
downloadcoreutils-0d457a806390379c51b2496ff596ab23a01aac8c.tar.xz
.
Diffstat (limited to 'tests/tac')
-rw-r--r--tests/tac/Makefile.am39
-rw-r--r--tests/tac/Makefile.in197
-rw-r--r--tests/tac/Test.pm37
3 files changed, 273 insertions, 0 deletions
diff --git a/tests/tac/Makefile.am b/tests/tac/Makefile.am
new file mode 100644
index 000000000..de4764cf3
--- /dev/null
+++ b/tests/tac/Makefile.am
@@ -0,0 +1,39 @@
+## Process this file with automake to produce Makefile.in.
+
+##test-files-begin
+x = tac
+##test-files-end
+
+EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
+noinst_SCRIPTS = $x-tests
+
+PERL = @PERL@
+editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
+
+TESTS = $x-tests
+
+$x-tests: @MAINT@mk-script Test.pm
+ ./mk-script ../../src/$x > $@.n
+ mv $@.n $@
+ chmod 755 $@
+
+SUFFIXES = .pl
+
+.pl:
+ rm -f $@ $@.tmp
+ $(editpl) $< > $@.tmp
+ chmod +x-w $@.tmp
+ mv $@.tmp $@
+
+MAINTAINERCLEANFILES = $x-tests $(maint_gen)
+CLEANFILES = $(run_gen)
+
+@MAINT@rebuild-check: Test.pm mk-script
+@MAINT@ rb=rb-check; rm -f $rb; \
+@MAINT@ m_template=../Makefile.am.in; \
+@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
+@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
+@MAINT@ echo "x = $$tool" >> $$rb; \
+@MAINT@ ./mk-script --list >> $$rb; \
+@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
+@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
diff --git a/tests/tac/Makefile.in b/tests/tac/Makefile.in
new file mode 100644
index 000000000..2b4ef2ac1
--- /dev/null
+++ b/tests/tac/Makefile.in
@@ -0,0 +1,197 @@
+# Makefile.in generated automatically by automake 1.1l from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ../..
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+RANLIB = @RANLIB@
+GENCAT = @GENCAT@
+GMSGFMT = @GMSGFMT@
+CC = @CC@
+
+x = tac
+
+EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
+noinst_SCRIPTS = $x-tests
+
+PERL = @PERL@
+editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
+
+TESTS = $x-tests
+
+SUFFIXES = .pl
+
+MAINTAINERCLEANFILES = $x-tests $(maint_gen)
+CLEANFILES = $(run_gen)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../../config.h
+CONFIG_CLEAN_FILES =
+SCRIPTS = $(noinst_SCRIPTS)
+
+DIST_COMMON = Makefile.am Makefile.in
+
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
+ $(TEXINFOS) $(MANS) $(EXTRA_DIST)
+
+TAR = tar
+default: all
+
+.SUFFIXES:
+.SUFFIXES: .pl
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
+ cd $(top_srcdir) && automake --gnu tests/tac/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = tests/tac
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+check-TESTS: $(TESTS)
+ @failed=0; all=0; \
+ srcdir=$(srcdir); export srcdir; \
+ for tst in $(TESTS); do \
+ all=`expr $$all + 1`; \
+ if test -f $$tst; then dir=.; \
+ else dir="$(srcdir)"; fi; \
+ if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
+ echo "PASS: $$tst"; \
+ else \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ echo "========================"; \
+ echo "All $$all tests passed"; \
+ echo "========================"; \
+ else \
+ echo "$$failed of $$all tests failed"; \
+ fi
+info:
+dvi:
+check: all
+ $(MAKE) check-TESTS
+installcheck:
+install-exec:
+ $(NORMAL_INSTALL)
+
+install-data:
+ $(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall:
+
+all: $(SCRIPTS) Makefile
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
+installdirs:
+
+
+mostlyclean-generic:
+ test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ rm -f Makefile $(DISTCLEANFILES)
+ rm -f config.cache config.log stamp-h
+ test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-generic
+
+clean: clean-generic mostlyclean
+
+distclean: distclean-generic clean
+ rm -f config.status
+
+maintainer-clean: maintainer-clean-generic distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: default tags distdir check-TESTS info dvi installcheck \
+install-exec install-data install uninstall all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+$x-tests: @MAINT@mk-script Test.pm
+ ./mk-script ../../src/$x > $@.n
+ mv $@.n $@
+ chmod 755 $@
+
+.pl:
+ rm -f $@ $@.tmp
+ $(editpl) $< > $@.tmp
+ chmod +x-w $@.tmp
+ mv $@.tmp $@
+
+@MAINT@rebuild-check: Test.pm mk-script
+@MAINT@ rb=rb-check; rm -f $rb; \
+@MAINT@ m_template=../Makefile.am.in; \
+@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
+@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
+@MAINT@ echo "x = $$tool" >> $$rb; \
+@MAINT@ ./mk-script --list >> $$rb; \
+@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
+@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/tac/Test.pm b/tests/tac/Test.pm
new file mode 100644
index 000000000..cf90d7bab
--- /dev/null
+++ b/tests/tac/Test.pm
@@ -0,0 +1,37 @@
+package Test;
+require 5.002;
+use strict;
+
+my @tv = (
+# test name, options, input, expected output, expected return code
+#
+['basic-0', '', "", "", 0],
+['basic-a', '', "a", "a\n", 0],
+['basic-b', '', "\n", "\n", 0],
+['basic-c', '', "a\n", "a\n", 0],
+['basic-d', '', "a\nb", "b\na\n", 0],
+['basic-e', '', "a\nb\n", "b\na\n", 0],
+);
+
+sub test_vector
+{
+ my $t;
+ foreach $t (@tv)
+ {
+ my ($test_name, $flags, $in, $exp, $ret) = @$t;
+
+ # If you run the minus* tests with a FILE arg they'd hang.
+ if ($test_name =~ /^minus/)
+ {
+ $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0};
+ }
+ else
+ {
+ $Test::input_via{$test_name} = {REDIR => 0, FILE => 0, PIPE => 0}
+ }
+ }
+
+ return @tv;
+}
+
+1;