* New File(URI) test
@ 2005-12-13 13:46 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2005-12-13 13:46 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1.1: Type: text/plain, Size: 205 bytes --]
Hi,
This test was inspired by a recent libgcj bug report (PR25389).
2005-12-13 Mark Wielaard <mark@klomp.org>
* gnu/testlet/java/io/File/newFileURI.java: New test.
Committed,
Mark
[-- Attachment #1.2: newFileURI.java --]
[-- Type: text/x-java, Size: 2293 bytes --]
// Tags: JDK1.4
// Copyright (C) 2005 Free Software Foundation, Inc.
// Written by Mark Wielaard (mark@klomp.org)
// This file is part of Mauve.
// Mauve 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, or (at your option)
// any later version.
// Mauve 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 Mauve; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301 USA.
package gnu.testlet.java.io.File;
import java.io.IOException;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;
public class newFileURI implements Testlet
{
public void test (TestHarness harness)
{
try
{
File file = new File(".");
URI uri = file.toURI();
File urifile = new File(uri);
// Check that we get back the original (absolute) file.
harness.check(urifile, file.getAbsoluteFile());
boolean nullthrown = false;
try
{
new File((URI) null);
}
catch (NullPointerException npe)
{
nullthrown = true;
}
harness.check(nullthrown);
boolean illegalthrown = false;
try
{
new File(new URI("ftp://ftp.gnu.org/gnu/classpath"));
}
catch(IllegalArgumentException iae)
{
illegalthrown = true;
}
harness.check(illegalthrown);
// Current dir
harness.check(new File("").getCanonicalFile(),
new File(".").getCanonicalFile());
uri = new URI("file:./");
urifile = new File(uri).getCanonicalFile();
harness.check(urifile, new File(".").getCanonicalFile());
}
catch (IOException ioe)
{
harness.debug(ioe);
harness.check(false, ioe.toString());
}
catch (URISyntaxException use)
{
harness.debug(use);
harness.check(false, use.toString());
}
}
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-12-13 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 13:46 New File(URI) test Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).