aboutsummaryrefslogtreecommitdiffstats
path: root/util/testsrc
diff options
context:
space:
mode:
authoraclement <aclement>2006-06-07 15:52:35 +0000
committeraclement <aclement>2006-06-07 15:52:35 +0000
commit5a75601c50821c333d1777f0c4b7236368b175af (patch)
tree57da61617f09c62c2416b652dd3c61b31c1595e9 /util/testsrc
parentc3898d9b4eb958e58741fbd31a5c85c16ae5ddd2 (diff)
downloadaspectj-5a75601c50821c333d1777f0c4b7236368b175af.tar.gz
aspectj-5a75601c50821c333d1777f0c4b7236368b175af.zip
141730 - latest variant of program element signature processing
Diffstat (limited to 'util/testsrc')
-rw-r--r--util/testsrc/org/aspectj/util/NameConvertorTest.java83
-rw-r--r--util/testsrc/org/aspectj/util/UtilTests.java1
2 files changed, 84 insertions, 0 deletions
diff --git a/util/testsrc/org/aspectj/util/NameConvertorTest.java b/util/testsrc/org/aspectj/util/NameConvertorTest.java
new file mode 100644
index 000000000..e33bf811e
--- /dev/null
+++ b/util/testsrc/org/aspectj/util/NameConvertorTest.java
@@ -0,0 +1,83 @@
+/********************************************************************
+ * Copyright (c) 2006 Contributors. All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ * Helen Hawkins - initial version
+ *******************************************************************/
+package org.aspectj.util;
+
+import junit.framework.TestCase;
+
+public class NameConvertorTest extends TestCase {
+
+ public void testBoolean() {
+ checkConversion("Z","boolean");
+ }
+
+ public void testByte() {
+ checkConversion("B","byte");
+ }
+
+ public void testChar() {
+ checkConversion("C","char");
+ }
+
+ public void testDouble() {
+ checkConversion("D","double");
+ }
+
+ public void testFloat() {
+ checkConversion("F","float");
+ }
+
+ public void testInt() {
+ checkConversion("I","int");
+ }
+
+ public void testLong() {
+ checkConversion("J","long");
+ }
+
+ public void testShort() {
+ checkConversion("S","short");
+ }
+
+ public void testString() {
+ checkConversion("Ljava/lang/String;","java.lang.String");
+ }
+
+ public void testType() {
+ checkConversion("LMyClass;","MyClass");
+ }
+
+ public void testListPameterizedWithString() {
+ checkConversion("Pjava/util/List<Ljava/lang/String;>;",
+ "java.util.List<java.lang.String>");
+ }
+ public void testClassParameterizedWithStringAndType() {
+ checkConversion("PMyGenericClass<Ljava/lang/String;LMyClass;>;",
+ "MyGenericClass<java.lang.String,MyClass>");
+ }
+ public void testStringArray() {
+ checkConversion("[Ljava/lang/String;","java.lang.String[]");
+ }
+ public void testTwoDimensionalStringArray() {
+ checkConversion("[[Ljava/lang/String;","java.lang.String[][]");
+ }
+ public void testIntArray() {
+ checkConversion("[I","int[]");
+ }
+
+ private void checkConversion(String signature, String expected) {
+ char[] c = NameConvertor.convertFromSignature(signature.toCharArray());
+ assertTrue("converting " + signature + ", expected " + expected + "," +
+ "but found " + String.valueOf(c),
+ CharOperation.equals(c,expected.toCharArray()));
+ }
+
+
+}
diff --git a/util/testsrc/org/aspectj/util/UtilTests.java b/util/testsrc/org/aspectj/util/UtilTests.java
index dfc80b220..8d2f183c2 100644
--- a/util/testsrc/org/aspectj/util/UtilTests.java
+++ b/util/testsrc/org/aspectj/util/UtilTests.java
@@ -23,6 +23,7 @@ public class UtilTests extends TestCase {
//$JUnit-BEGIN$
suite.addTestSuite(FileUtilTest.class);
suite.addTestSuite(LangUtilTest.class);
+ suite.addTestSuite(NameConvertorTest.class);
//$JUnit-END$
return suite;
}