On 10:54 Sun 12 Dec , Pekka Enberg wrote: > On Thu, 2010-12-09 at 12:45 +0000, Dr Andrew John Hughes wrote: > > I disagree. Just because the version in gcj is different doesn't mean > > it's correct. As far as I'm aware, Pekka already has a testcase for > > this so it would be good to have it in Mauve. > > Sorry for the delay, here's a test case for getSimpleName(). > > Pekka > > >From 3637ab8ec4f866da6fadc092eab1f99ce4adb417 Mon Sep 17 00:00:00 2001 > From: Pekka Enberg <penberg@xxxxxxxxxx> > Date: Sun, 12 Dec 2010 10:52:27 +0200 > Subject: [PATCH] mauve: Add test case for Class.getSimpleName() > > Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> > --- > gnu/testlet/java/lang/Class/ClassTest.java | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/gnu/testlet/java/lang/Class/ClassTest.java b/gnu/testlet/java/lang/Class/ClassTest.java > index 71b144c..c5927e8 100644 > --- a/gnu/testlet/java/lang/Class/ClassTest.java > +++ b/gnu/testlet/java/lang/Class/ClassTest.java > @@ -577,6 +577,18 @@ public class ClassTest implements Cloneable, java.io.Serializable, Testlet > harness.check(in == null); > } > > + public void test_getSimpleName() > + { > + harness.checkPoint("test_getSimpleName"); > + harness.check(int.class.getSimpleName().equals("int")); > + harness.check(int[].class.getSimpleName().equals("int[]")); > + harness.check(int[][].class.getSimpleName().equals("int[][]")); > + harness.check(Object[].class.getSimpleName().equals("Object[]")); > + harness.check(Object.class.getSimpleName().equals("Object")); > + harness.check(InnerClass.class.getSimpleName().equals("InnerClass")); > + } > + public static class InnerClass { }; > + > public void testall() > { > test_toString(); > @@ -594,6 +606,7 @@ public class ClassTest implements Cloneable, java.io.Serializable, Testlet > // This one doesn't work so well in Mauve. > // test_getResource(); > test_getResourceAsStream(); > + test_getSimpleName(); > > } > > -- > 1.7.0.4 > > > I've committed this to Mauve as a new test case (rather than extending ClassTest) as this should make it easier to run. I also added cases to check anonymous classes which should return "". This test also unearthed another bug in CACAO which seems to think that the class of an array of an anonymous class is anonymous, while gcj, jamvm and OpenJDK all disagree. This causes it to still fail one of the test cases as it returns "" instead of "[]" for an array class with a component type that is an anonymous class. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) Support Free Java! Contribute to GNU Classpath and IcedTea http://www.gnu.org/software/classpath http://icedtea.classpath.org PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8