tests/libjava-mauve/src/gnu/testlet/java/io/File/UnicodeURI.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.4
       
     2 
       
     3 // Copyright (C) 2005 Free Software Foundation, Inc.
       
     4 // Written by Tom Tromey <tromey@redhat.com>,
       
     5 //            Dalibor Topic <robilad@kaffe.org>
       
     6 
       
     7 // This file is part of Mauve.
       
     8 
       
     9 // Mauve is free software; you can redistribute it and/or modify
       
    10 // it under the terms of the GNU General Public License as published by
       
    11 // the Free Software Foundation; either version 2, or (at your option)
       
    12 // any later version.
       
    13 
       
    14 // Mauve is distributed in the hope that it will be useful,
       
    15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    17 // GNU General Public License for more details.
       
    18 
       
    19 // You should have received a copy of the GNU General Public License
       
    20 // along with Mauve; see the file COPYING.  If not, write to
       
    21 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    22 // Boston, MA 02111-1307, USA.  */
       
    23 
       
    24 package gnu.testlet.java.io.File;
       
    25 
       
    26 import java.io.File;
       
    27 import java.net.URL;
       
    28 import java.net.MalformedURLException;
       
    29 
       
    30 import gnu.testlet.Testlet;
       
    31 import gnu.testlet.TestHarness;
       
    32 
       
    33 public class UnicodeURI implements Testlet
       
    34 {
       
    35   private static final String LATIN_SMALL_LETTER_C_WITH_ACUTE = "\u0107";
       
    36   private static final String fname =  "/tmp/" + LATIN_SMALL_LETTER_C_WITH_ACUTE;
       
    37 
       
    38   public void check (TestHarness harness, URL url)
       
    39   {
       
    40     final String protocol = url.getProtocol();
       
    41     final String file = url.getFile();
       
    42 
       
    43     harness.verbose("protocol: " + protocol);
       
    44     harness.verbose("file: " + file);
       
    45 
       
    46     harness.check(protocol, "file");
       
    47     harness.check(file, fname);
       
    48   }
       
    49 
       
    50   public void test (TestHarness harness)
       
    51   {
       
    52     File f = new File(fname);
       
    53     harness.checkPoint("toURL");
       
    54     try
       
    55       {
       
    56 	check(harness, f.toURL());
       
    57       }
       
    58     catch (MalformedURLException _)
       
    59       {
       
    60 	harness.debug(_);
       
    61 	harness.check(false);
       
    62       }
       
    63 
       
    64     harness.checkPoint("toURI");
       
    65     try
       
    66       {
       
    67 	check(harness, f.toURI().toURL());
       
    68       }
       
    69     catch (MalformedURLException _)
       
    70       {
       
    71 	harness.debug(_);
       
    72 	harness.check(false);
       
    73       }
       
    74   }
       
    75 }