summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-06-07 13:56:20 +0000
committerJim Meyering <jim@meyering.net>1998-06-07 13:56:20 +0000
commit94ff35fc2ddd62125303d8f12b6eeb1350f69167 (patch)
treecea26ffe5d9d3265fdf22ef700312ea3bf3d53c2
parentdc6658157ddacf7867f8fbf58d86ad01b208121c (diff)
downloadcoreutils-94ff35fc2ddd62125303d8f12b6eeb1350f69167.tar.xz
.
-rw-r--r--tests/test/.cvsignore8
-rw-r--r--tests/test/Makefile.am37
-rw-r--r--tests/test/Makefile.in269
-rw-r--r--tests/test/Test.pm39
4 files changed, 353 insertions, 0 deletions
diff --git a/tests/test/.cvsignore b/tests/test/.cvsignore
new file mode 100644
index 000000000..852508156
--- /dev/null
+++ b/tests/test/.cvsignore
@@ -0,0 +1,8 @@
+*.I
+*.E
+*.X
+*.O
+*-tests
+build-script
+Makefile
+mk-script
diff --git a/tests/test/Makefile.am b/tests/test/Makefile.am
new file mode 100644
index 000000000..5cf82f627
--- /dev/null
+++ b/tests/test/Makefile.am
@@ -0,0 +1,37 @@
+## Process this file with automake to produce Makefile.in -*-Makefile-*-.
+
+##test-files-begin
+x = date
+explicit =
+maint_gen = 1a.X 1b.X 1c.X 1d.X and-1.X and-2.X and-3.X and-4.X or-1.X or-2.X \
+or-3.X or-4.X t1.X t2.X
+run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E and-1.O and-1.E and-2.O \
+and-2.E and-3.O and-3.E and-4.O and-4.E or-1.O or-1.E or-2.O or-2.E or-3.O \
+or-3.E or-4.O or-4.E t1.O t1.E t2.O t2.E
+##test-files-end
+
+EXTRA_DIST = 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
+
+mk_script = $(srcdir)/../mk-script
+$(srcdir)/$x-tests: $(mk_script) Test.pm
+ $(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
+ mv $@.n $@
+ chmod 755 $@
+
+MAINTAINERCLEANFILES = $x-tests $(maint_gen)
+CLEANFILES = $(run_gen)
+
+Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
+ rm -f $@ $@t
+ sed -n '1,/^##test-files-begin/p' $< > $@t
+ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
+ echo "x = $$tool" >> $@t
+ $(PERL) -I. -w -- $(mk_script) --list >> $@t
+ sed -n '/^##test-files-end/,$$p' $< >> $@t
+ mv $@t $@
diff --git a/tests/test/Makefile.in b/tests/test/Makefile.in
new file mode 100644
index 000000000..7877330d4
--- /dev/null
+++ b/tests/test/Makefile.in
@@ -0,0 +1,269 @@
+# Makefile.in generated automatically by automake 1.3 from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+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
+
+DISTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+GENCAT = @GENCAT@
+GETHOSTBYNAME_LIB = @GETHOSTBYNAME_LIB@
+GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNU_PACKAGE = @GNU_PACKAGE@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+KMEM_GROUP = @KMEM_GROUP@
+LIBOBJS = @LIBOBJS@
+LIB_CRYPT = @LIB_CRYPT@
+MAKEINFO = @MAKEINFO@
+MAN = @MAN@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+NEED_SETGID = @NEED_SETGID@
+OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
+OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+POW_LIBM = @POW_LIBM@
+RANLIB = @RANLIB@
+SEQ_LIBM = @SEQ_LIBM@
+SQRT_LIBM = @SQRT_LIBM@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+YACC = @YACC@
+l = @l@
+
+x = test
+explicit =
+maint_gen = 1.X 2.X 3.X 4.X 5.X 6.X 7.X 8.X 9.X leap-1.X U95-1.X U95-2.X \
+U95-3.X U92-1.X U92-2.X U92-3.X V92-1.X V92-2.X V92-3.X W92-1.X W92-2.X \
+W92-3.X millen-1.X rel-0.X rel-1a.X rel-1b.X rel-2a.X rel-2b.X rel-2c.X \
+rel-2d.X rel-2e.X rel-2f.X rel-2g.X rel-3a.X next-s.X next-m.X next-h.X \
+next-d.X next-w.X next-mo.X next-y.X utc-0.X utc-0a.X utc-1.I utc-1.X \
+utc-1a.I utc-1a.X date2sec-0.X date2sec-0a.X date2sec-1.X sec2date-0.X
+run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E 8.O 8.E 9.O \
+9.E leap-1.O leap-1.E U95-1.O U95-1.E U95-2.O U95-2.E U95-3.O U95-3.E U92-1.O \
+U92-1.E U92-2.O U92-2.E U92-3.O U92-3.E V92-1.O V92-1.E V92-2.O V92-2.E \
+V92-3.O V92-3.E W92-1.O W92-1.E W92-2.O W92-2.E W92-3.O W92-3.E millen-1.O \
+millen-1.E rel-0.O rel-0.E rel-1a.O rel-1a.E rel-1b.O rel-1b.E rel-2a.O \
+rel-2a.E rel-2b.O rel-2b.E rel-2c.O rel-2c.E rel-2d.O rel-2d.E rel-2e.O \
+rel-2e.E rel-2f.O rel-2f.E rel-2g.O rel-2g.E rel-3a.O rel-3a.E next-s.O \
+next-s.E next-m.O next-m.E next-h.O next-h.E next-d.O next-d.E next-w.O \
+next-w.E next-mo.O next-mo.E next-y.O next-y.E utc-0.O utc-0.E utc-0a.O \
+utc-0a.E utc-1.O utc-1.E utc-1a.O utc-1a.E date2sec-0.O date2sec-0.E \
+date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
+sec2date-0.E
+
+EXTRA_DIST = 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
+
+mk_script = $(srcdir)/../mk-script
+
+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
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP = --best
+all: Makefile $(SCRIPTS)
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/test/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/test
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/test/Makefile
+ @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 \
+ if test -f $$tst; then dir=.; \
+ else dir="$(srcdir)"; fi; \
+ if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
+ all=`expr $$all + 1`; \
+ echo "PASS: $$tst"; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="$$failed of $$all tests failed"; \
+ fi; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0
+info:
+dvi:
+check: all
+ $(MAKE) check-TESTS
+installcheck:
+install-exec:
+ @$(NORMAL_INSTALL)
+
+install-data:
+ @$(NORMAL_INSTALL)
+
+install: install-exec install-data all
+ @:
+
+uninstall:
+
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' 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 stamp-h[0-9]*
+ -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: 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
+
+$(srcdir)/$x-tests: $(mk_script) Test.pm
+ $(PERL) -I. -w -- $(mk_script) ../../src/$x > $@.n
+ mv $@.n $@
+ chmod 755 $@
+
+Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
+ rm -f $@ $@t
+ sed -n '1,/^##test-files-begin/p' $< > $@t
+ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
+ echo "x = $$tool" >> $@t
+ $(PERL) -I. -w -- $(mk_script) --list >> $@t
+ sed -n '/^##test-files-end/,$$p' $< >> $@t
+ mv $@t $@
+
+# 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/test/Test.pm b/tests/test/Test.pm
new file mode 100644
index 000000000..3f739d41c
--- /dev/null
+++ b/tests/test/Test.pm
@@ -0,0 +1,39 @@
+# -*-perl-*-
+package Test;
+require 5.002;
+use strict;
+
+# For each test...
+# Export LANG=C so that the locale-dependent strings match.
+# Export TZ=UTC so that zone-dependent strings match.
+$Test::env_default = ['LANG=C TZ=UTC'];
+
+sub test_vector
+{
+ my @tvec =
+ (
+ # test-name options input expected-output expected-return-code
+ #
+ ['1a', '', {}, '', 1],
+ ['1b', "-z ''", {}, '', 0],
+ ['1c', 'any-string', {}, '', 0],
+ ['1d', '-n any-string', {}, '', 0],
+
+ ['and-1', 't -a t', {}, '', 0],
+ ['and-2', '"" -a t', {}, '', 1],
+ ['and-3', 't -a ""', {}, '', 1],
+ ['and-4', '"" -a ""', {}, '', 1],
+
+ ['or-1', 't -o t', {}, '', 0],
+ ['or-2', '"" -o t', {}, '', 0],
+ ['or-3', 't -o ""', {}, '', 0],
+ ['or-4', '"" -o ""', {}, '', 1],
+
+ ['t1', "-t", {}, '', 1],
+ ['t2', "-t 1", {}, '', 1],
+ );
+
+ return @tvec;
+}
+
+1;