From d9cd0d44e8c42f06e13b033ae1cc269d3e7f7c29 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 23 Jan 2019 19:36:37 -0800 Subject: mavenizing asm module - wip --- .../test/java/org/aspectj/asm/AsmModuleTests.java | 34 +++++++++ .../java/org/aspectj/asm/NameConvertorTest.java | 86 ++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 asm/src/test/java/org/aspectj/asm/AsmModuleTests.java create mode 100644 asm/src/test/java/org/aspectj/asm/NameConvertorTest.java (limited to 'asm/src/test') 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;", "java.util.List"); + } + + public void testClassParameterizedWithStringAndType() { + checkConversion("PMyGenericClass;", "MyGenericClass"); + } + + 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())); + } + +} -- cgit v1.2.3