diff --exclude-from=../mauve-ignore -uNr mauve.orig/ChangeLog mauve/ChangeLog --- mauve.orig/ChangeLog Fri Mar 16 17:30:32 2001 +++ mauve/ChangeLog Fri Mar 16 18:00:06 2001 @@ -1,3 +1,18 @@ +2001-03-16 Brian Jones + + * acinclude.java: New file. + * configure.in: Added check for Win32, even in cross-compile. + This is used for java.io.File testing. + * gnu/testlet/SimpleTestHarness.java: Implements config from config.java; + Required to obtain variables from the test harness generically + passed to tests and call abstract getSourceDirectory(). + * gnu/testlet/TestHarness.java: Implements config similarly to + SimpleTestHarness. + * gnu/testlet/config.java.in: Added @PATH_SEPARATOR@ and @FILE_SEPARATOR@ as + static Strings. + * gnu/testlet/java/io/File/DocFilter.java: New file. + * gnu/testlet/java/io/File/jdk11.java: New file. + 2001-02-19 Tom Tromey * gnu/testlet/java/lang/ThreadGroup/enumerate.java: New file. diff --exclude-from=../mauve-ignore -uNr mauve.orig/acinclude.m4 mauve/acinclude.m4 --- mauve.orig/acinclude.m4 Wed Dec 31 19:00:00 1969 +++ mauve/acinclude.m4 Thu Feb 8 23:46:53 2001 @@ -0,0 +1,31 @@ +dnl ----------------------------------------------------------- +dnl Original by Mark Elbrecht +dnl Modified by Brian Jones for Mauve +dnl acx_check_pathname_style.m4 +dnl http://research.cys.de/autoconf-archive/ + +AC_DEFUN(ACX_CHECK_PATHNAME_STYLE_DOS, +[AC_MSG_CHECKING(for Windows and DOS and OS/2 style pathnames) +AC_CACHE_VAL(acx_cv_pathname_style_dos, + [AC_REQUIRE([AC_CANONICAL_HOST]) + acx_cv_pathname_style_dos="no" + case ${host_os} in + *djgpp | *mingw32* | *emx*) acx_cv_pathname_style_dos="yes" ;; + esac + ]) +AC_MSG_RESULT($acx_cv_pathname_style_dos) +if test "$acx_cv_pathname_style_dos" = "yes"; then + AC_DEFINE(HAVE_PATHNAME_STYLE_DOS,,[defined if running on a system with dos style paths]) + PATH_SEPARATOR=';' + FILE_SEPARATOR='\\' + AC_SUBST(PATH_SEPARATOR) + AC_SUBST(FILE_SEPARATOR) +else + PATH_SEPARATOR=':' + FILE_SEPARATOR='/' + AC_SUBST(PATH_SEPARATOR) + AC_SUBST(FILE_SEPARATOR) +fi +]) + +dnl ----------------------------------------------------------- diff --exclude-from=../mauve-ignore -uNr mauve.orig/config.h.in mauve/config.h.in --- mauve.orig/config.h.in Wed Dec 31 19:00:00 1969 +++ mauve/config.h.in Thu Feb 22 23:56:02 2001 @@ -0,0 +1,11 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + +/* defined if running on a system with dos style paths */ +#undef HAVE_PATHNAME_STYLE_DOS + diff --exclude-from=../mauve-ignore -uNr mauve.orig/configure.in mauve/configure.in --- mauve.orig/configure.in Mon Jul 5 11:31:54 1999 +++ mauve/configure.in Thu Feb 22 23:51:10 2001 @@ -2,6 +2,9 @@ AC_INIT(gnu/testlet/Testlet.java) AM_INIT_AUTOMAKE(mauve, 0.0) +dnl Check path and file separator types +ACX_CHECK_PATHNAME_STYLE_DOS + AC_ARG_WITH(gcj, [ --with-gcj Use gcj to compile .class files]) AM_CONDITIONAL(USE_GCJ, test "$with_gcj" = yes) @@ -59,4 +62,5 @@ mkdir gnu/testlet fi -AC_OUTPUT(Makefile gnu/testlet/config.java) +AC_OUTPUT(Makefile +gnu/testlet/config.java) diff --exclude-from=../mauve-ignore -uNr mauve.orig/gnu/testlet/SimpleTestHarness.java mauve/gnu/testlet/SimpleTestHarness.java --- mauve.orig/gnu/testlet/SimpleTestHarness.java Thu Feb 8 06:27:46 2001 +++ mauve/gnu/testlet/SimpleTestHarness.java Fri Feb 23 00:03:07 2001 @@ -29,7 +29,7 @@ public class SimpleTestHarness extends TestHarness - implements gnu.testlet.config + implements config { private int count = 0; private int failures = 0; diff --exclude-from=../mauve-ignore -uNr mauve.orig/gnu/testlet/TestHarness.java mauve/gnu/testlet/TestHarness.java --- mauve.orig/gnu/testlet/TestHarness.java Tue Mar 16 04:42:10 1999 +++ mauve/gnu/testlet/TestHarness.java Fri Feb 23 00:02:33 2001 @@ -23,7 +23,7 @@ import java.io.Reader; import java.io.InputStream; -public abstract class TestHarness +public abstract class TestHarness implements config { // These methods are used to determine whether a test has passed. public abstract void check (boolean result); diff --exclude-from=../mauve-ignore -uNr mauve.orig/gnu/testlet/config.java.in mauve/gnu/testlet/config.java.in --- mauve.orig/gnu/testlet/config.java.in Tue Mar 30 13:46:25 1999 +++ mauve/gnu/testlet/config.java.in Thu Feb 22 23:50:21 2001 @@ -24,7 +24,9 @@ { public static final String srcdir = "@SRCDIR@"; public static final String tmpdir = "@TMPDIR@"; - + public static final String pathSeparator = "@PATH_SEPARATOR@"; + public static final String separator = "@FILE_SEPARATOR@"; + public abstract String getSourceDirectory (); public abstract String getTempDirectory (); } diff --exclude-from=../mauve-ignore -uNr mauve.orig/gnu/testlet/java/io/File/DocFilter.java mauve/gnu/testlet/java/io/File/DocFilter.java --- mauve.orig/gnu/testlet/java/io/File/DocFilter.java Wed Dec 31 19:00:00 1969 +++ mauve/gnu/testlet/java/io/File/DocFilter.java Fri Mar 9 00:11:09 2001 @@ -0,0 +1,14 @@ +package gnu.testlet.java.io.File; + +import java.io.FilenameFilter; +import java.io.File; + +public class DocFilter implements FilenameFilter +{ + public boolean accept (File dir, String name) + { + if (name.endsWith (".doc")) + return true; + return false; + } +} diff --exclude-from=../mauve-ignore -uNr mauve.orig/gnu/testlet/java/io/File/jdk11.java mauve/gnu/testlet/java/io/File/jdk11.java --- mauve.orig/gnu/testlet/java/io/File/jdk11.java Wed Dec 31 19:00:00 1969 +++ mauve/gnu/testlet/java/io/File/jdk11.java Fri Mar 16 17:49:34 2001 @@ -0,0 +1,312 @@ +/************************************************************************* +/* jdk11.java -- java.io.File 1.1 tests +/* +/* Copyright (c) 2001 Free Software Foundation, Inc. +/* +/* This program is free software; you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published +/* by the Free Software Foundation, either version 2 of the License, or +/* (at your option) any later version. +/* +/* This program is distributed in the hope that it will be useful, but +/* WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with this program; if not, write to the Free Software Foundation +/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA +/*************************************************************************/ + +// Tags: JDK1.1 + +package gnu.testlet.java.io.File; + +import gnu.testlet.Testlet; +import gnu.testlet.TestHarness; +import gnu.testlet.SimpleTestHarness; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.util.Date; + +public class jdk11 implements Testlet +{ + + public void test (TestHarness testharness) + { + SimpleTestHarness harness = null; + try + { + harness = (SimpleTestHarness)testharness; + } + catch (ClassCastException cce) + { + harness.fail ("Harness not an instance of SimpleTestHarness"); + return; + } + + String srcdirstr = harness.getSourceDirectory (); + String tmpdirstr = harness.getTempDirectory (); + + // File (String) + File srcdir = new File (srcdirstr); + File tmpdir = new File (tmpdirstr); + String THIS_FILE = new String ("gnu" + + File.separator + "testlet" + + File.separator + "java" + + File.separator + "io" + + File.separator + "File" + + File.separator + "tmp"); + + // File (File, String) + File cons = new File (srcdir, THIS_FILE); + // File (String, String) + File cons2 = new File (srcdirstr, THIS_FILE); + + + // mkdir () + harness.check (cons.mkdir (), "mkdir ()"); + + // canRead () + harness.check (cons.canRead (), "canRead ()"); + // equals (Object) + harness.check (cons.equals (cons2), "equals ()"); + // isDirectory () + harness.check (srcdir.isDirectory (), "isDirectory ()"); + harness.check (tmpdir.isDirectory (), "isDirectory ()"); + + String TMP_FILENAME = "File.tst"; + String TMP_FILENAME2 = "Good.doc"; + String TMP_FILENAME3 = "File.doc"; + + // create empty file + File tmp = new File (cons, TMP_FILENAME); + try + { + FileOutputStream fos = new FileOutputStream (tmp); + fos.close (); + } + catch (FileNotFoundException fne) { } + catch (IOException ioe) { } + + // create empty file + File tmp2 = new File (cons, TMP_FILENAME2); + try + { + FileOutputStream fos = new FileOutputStream (tmp2); + fos.close (); + } + catch (FileNotFoundException fne) { } + catch (IOException ioe) { } + + File tmp3 = new File (cons, TMP_FILENAME3); + + // canWrite () + harness.check (tmp.canWrite (), "canWrite()"); + // exists () + harness.check (tmp.exists (), "exists ()"); + // isFile () + harness.check (tmp.isFile (), "isFile ()"); + // length () + harness.check (tmp.length (), 0L, "length ()"); + byte[] b = new byte[2001]; + try + { + FileOutputStream fos = new FileOutputStream (tmp); + fos.write (b); + fos.close (); + } + catch (FileNotFoundException fne) { } + catch (IOException ioe) { } + harness.check (tmp.length (), b.length, "length ()"); + + // toString (); + String tmpstr = new String (srcdirstr + File.separator + + THIS_FILE + File.separator + + TMP_FILENAME); + harness.debug (tmp.toString () + " =? " + tmpstr); + harness.check (tmp.toString ().equals (tmpstr), "toString ()"); + + // list (); + String [] tmpdirlist = cons.list (); + String [] expectedlist = new String[] {TMP_FILENAME, TMP_FILENAME2}; +// for (int ll=0; ll= " + time); + if (lastmod.lastModified () >= time) + harness.check (true, "lastModified ()"); + else + harness.check (false, "lastModified ()"); + if (lastmod.exists ()) + lastmod.delete (); + } + + /** + * Compare two String arrays, and if of the same length compare + * contents for equality, order does not matter. + */ + private boolean compareStringArray (String[] x, String[] y) + { + if (x.length != y.length) + return false; + + boolean[] test = new boolean[y.length]; + for (int i = 0; i < test.length; i++) + test[i] = true; + + for (int i = 0; i < x.length; i++) + { + boolean nomatch = true; + for (int j = 0; j < y.length; j++) + { + if (test[j]) + if (x[i].equals (y[j])) + { + test[j] = false; + nomatch = false; + break; + } + } + if (nomatch) + return false; + } + return true; + } +} +