This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Fixes for AcuniaPropertiesTest
- From: Mark Wielaard <mark at klomp dot org>
- To: mauve-discuss at sources dot redhat dot com
- Date: 02 Mar 2003 23:06:07 +0100
- Subject: Fixes for AcuniaPropertiesTest
- Organization:
Hi,
I just committed the following fixes to the AcuniaPropertiesTest.
2003-03-02 Mark Wielaard <mark at klomp dot org>
* gnu/testlet/java/util/Properties/AcuniaPropertiesTest.java
(test_list): Skip -- header line.
(test_propertyNames): Enumeration of propertyNames() and keys() are
not necessarily in the same order.
(test_loadextra): Fix double escaped no\\cat. Add explanations for
corner cases.
Please check this if you relied on the previous outcome of some of these
tests. Results are now correct for current Classpath/libgcj and checked
against Blackdown-1.4.1-beta.
Cheers,
Mark
Index: gnu/testlet/java/util/Properties/AcuniaPropertiesTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Properties/AcuniaPropertiesTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaPropertiesTest.java
--- gnu/testlet/java/util/Properties/AcuniaPropertiesTest.java 20 Jul 2002 01:30:42 -0000 1.2
+++ gnu/testlet/java/util/Properties/AcuniaPropertiesTest.java 2 Mar 2003 21:49:57 -0000
@@ -191,7 +191,8 @@
start = count;
while ( ba[count] !='\n' && count < ba.length) { count++;}
s = new String(ba , start , count - start);
- th.check(v.contains(s), "v does not contain:$"+s+"$");
+ if (!s.startsWith("--")) // list() adds a header
+ th.check(v.contains(s), "v does not contain:$"+s+"$");
v.removeElement(s);
count++;
}
@@ -229,7 +230,8 @@
start = count;
while ( ba[count] !='\n' && count < ba.length) { count++;}
s = new String(ba , start , count - start);
- th.check(v.contains(s), "v does not contain:$"+s+"$");
+ if (!s.startsWith("--")) // list() adds a header
+ th.check(v.contains(s), "v does not contain:$"+s+"$");
v.removeElement(s);
count++;
}
@@ -301,10 +303,20 @@
Enumeration ek = p.keys();
boolean ok = true;
Vector v = new Vector();
- int i=0;
- while (ek.hasMoreElements() && en.hasMoreElements()) {
- v.add(ek.nextElement());
- if (v.elementAt(i++) != en.nextElement()) ok = false; }
+ Enumeration ek2 = p.keys();
+ while (ek2.hasMoreElements()) {
+ v.add(ek2.nextElement ());
+ }
+ while (ek.hasMoreElements() && en.hasMoreElements())
+ {
+ ek.nextElement();
+ Object next = en.nextElement();
+ if (!v.contains(next))
+ {
+ ok = false;
+ th.debug(next + " not in " + v);
+ }
+ }
th.check(ok , "all elements are the same");
th.check( ! ek.hasMoreElements() && ! en.hasMoreElements() , "make sure both enumerations are empty");
p = new Properties(defProps);
@@ -500,12 +512,20 @@
public void test_loadextra(){
th.checkPoint("load(java.io.InputStream)void");
Properties p = new Properties();
- buffer =new String(" !comment\n \t \nname = no\r #morec\tomm\\\nents\r\n dog=no\\cat \nburps :\ntest=\ndate today\n\n\nlong\\\n value=tryin \\\n gto\n4:vier\nvier :4").getBytes();
+ buffer =new String(" !comment\n \t \nname = no\r #morec\tomm\\\nents\r\n dog=no\\\\cat \nburps :\ntest=\ndate today\n\n\nlong\\\n value=tryin \\\n gto\n4:vier\nvier :4").getBytes();
bin = new ByteArrayInputStream(buffer);
try {p.load(bin);} catch (Exception e) {}
Enumeration e = p.keys();
Vector v = new Vector();
+ // Yes, the following is valid.
+ // Names can contain a !, just not whitespace,
+ // and only lines starting with comment chars are ignored.
+ v.add("!comment=");
v.add("name=no");
+ // Yes, the following is valid
+ // Line starts with whitespace, not a comment
+ // and "\\\n" is a line continuation.
+ v.add("#morec=omments");
v.add("dog=no\\cat ");
v.add("burps=");
v.add("test=");