From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32721 invoked by alias); 13 Feb 2003 20:27:32 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 32697 invoked from network); 13 Feb 2003 20:27:31 -0000 Received: from unknown (HELO nescio.wildebeest.org) (62.108.28.95) by 172.16.49.205 with SMTP; 13 Feb 2003 20:27:31 -0000 Received: from elsschot.wildebeest.org ([192.168.1.26] ident=mark) by nescio.wildebeest.org with esmtp (Exim 3.35 #1 (Debian)) id 18jPvr-0004TZ-00; Thu, 13 Feb 2003 21:26:07 +0100 Subject: Re: gnu/testlet/java/util/jar/JarFile/basic.java From: Mark Wielaard To: John Leuner Cc: raif@fl.net.au, Mauve In-Reply-To: <1044373522.634.1.camel@cmalu> References: <200302042043.07439.raif@fl.net.au> <1044373522.634.1.camel@cmalu> Content-Type: multipart/mixed; boundary="=-+65H8kl6bs3YIyNOgWJm" Organization: Message-Id: <1045167984.30211.225.camel@elsschot> Mime-Version: 1.0 Date: Thu, 13 Feb 2003 20:27:00 -0000 X-SW-Source: 2003-q1/txt/msg00023.txt.bz2 --=-+65H8kl6bs3YIyNOgWJm Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 731 Hi, On Tue, 2003-02-04 at 16:45, John Leuner wrote: > I'm not sure if this test is correct, particularly the JarFile.entries() > tests. I think this test is a bit to strict. I could not found any order that the Enumeration should follow. When the order of the entries matters an application should probably use JarInputStream anyway. I have changed the test a little so that it only tests that the number of entries and the name and content of each entry match. 2003-02-13 Mark Wielaard * gnu/testlet/java/util/jar/JarFile/basic.java: Don't test order, only test that all entries have the correct content. If there are applications for which the order matters I like to hear about them. Cheers, Mark --=-+65H8kl6bs3YIyNOgWJm Content-Disposition: inline; filename=basic.diff Content-Type: text/x-patch; name=basic.diff; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Content-length: 2753 Index: gnu/testlet/java/util/jar/JarFile/basic.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/jar/JarFile/basic.java,v retrieving revision 1.2 diff -u -r1.2 basic.java --- gnu/testlet/java/util/jar/JarFile/basic.java 4 Feb 2003 14:40:01 -0000 1.2 +++ gnu/testlet/java/util/jar/JarFile/basic.java 13 Feb 2003 20:25:16 -0000 @@ -43,33 +43,31 @@ But it would seem likely that someone will write a program expecting the files to be enumerated the same way every time */ - int item = 1; + int item = 0; Enumeration e = jarfile.entries(); while(e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); + String n = je.getName(); String s = new BufferedReader(new InputStreamReader(jarfile.getInputStream(je))).readLine(); - switch(item) - { - case 1: - harness.check(s == null); - break; - case 2: - harness.check(s.equals("Manifest-Version: 1.0")); - break; - case 3: - harness.check(s.equals("this jar file was created with the jar tool for IBM JDK 1.3")); - break; - case 4: - harness.check(s.equals("We seek peace. We strive for peace. And sometimes peace must be defended. A future lived at the mercy of terrible threats is no peace at all. If war is forced upon us, we will fight in a just cause and by just means -- sparing, in every way we can, the innocent. And if war is forced upon us, we will fight with the full force and might of the United States military -- and we will prevail.")); - break; - case 5: - harness.check(s.equals("I am he as you are he as you are me and we are all together.")); - break; - } - // System.out.println("item " + item + " and string '" + s + "'"); + + if ("META-INF/".equals(n)) + harness.check(s == null); + else if ("META-INF/MANIFEST.MF".equals(n)) + harness.check(s.equals("Manifest-Version: 1.0")); + else if ("file1".equals(n)) + harness.check(s.equals("this jar file was created with the jar tool for IBM JDK 1.3")); + else if ("file2".equals(n)) + harness.check(s.equals("We seek peace. We strive for peace. And sometimes peace must be defended. A future lived at the mercy of terrible threats is no peace at all. If war is forced upon us, we will fight in a just cause and by just means -- sparing, in every way we can, the innocent. And if war is forced upon us, we will fight with the full force and might of the United States military -- and we will prevail.")); + else if ("file3".equals(n)) + harness.check(s.equals("I am he as you are he as you are me and we are all together.")); + else + harness.check(false, "Unexpected entry: " + n); + item++; } + + harness.check(item, 5); jarfile.close(); --=-+65H8kl6bs3YIyNOgWJm--