diff options
author | Andy Clement <aclement@pivotal.io> | 2019-01-23 19:36:37 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-01-23 19:36:37 -0800 |
commit | d9cd0d44e8c42f06e13b033ae1cc269d3e7f7c29 (patch) | |
tree | 821258f70f7f28e3e96faa82379708a038c84128 /asm/src/test | |
parent | 9803f22ec4337779057f4ec2ace35f2d6483d6dd (diff) | |
download | aspectj-d9cd0d44e8c42f06e13b033ae1cc269d3e7f7c29.tar.gz aspectj-d9cd0d44e8c42f06e13b033ae1cc269d3e7f7c29.zip |
mavenizing asm module - wip
Diffstat (limited to 'asm/src/test')
-rw-r--r-- | asm/src/test/java/org/aspectj/asm/AsmModuleTests.java | 34 | ||||
-rw-r--r-- | asm/src/test/java/org/aspectj/asm/NameConvertorTest.java | 86 |
2 files changed, 120 insertions, 0 deletions
diff --git a/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java b/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java new file mode 100644 index 000000000..ebb500911 --- /dev/null +++ b/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java @@ -0,0 +1,34 @@ +package org.aspectj.asm; +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation + * ******************************************************************/ + + +// default package + +import org.aspectj.asm.NameConvertorTest; + +import junit.framework.*; + +public class AsmModuleTests extends TestCase { + + public static TestSuite suite() { + TestSuite suite = new TestSuite(AsmModuleTests.class.getName()); + suite.addTestSuite(AsmModuleTests.class); + suite.addTestSuite(NameConvertorTest.class); + return suite; + } + + public AsmModuleTests(String name) { super(name); } + + public void testNothing() {} +} diff --git a/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java b/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java new file mode 100644 index 000000000..22ac3fb79 --- /dev/null +++ b/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java @@ -0,0 +1,86 @@ +/******************************************************************** + * 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.asm; + +import junit.framework.TestCase; + +import org.aspectj.asm.internal.CharOperation; +import org.aspectj.asm.internal.NameConvertor; + +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())); + } + +} |