diff options
author | mkersten <mkersten> | 2003-07-30 09:10:45 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-07-30 09:10:45 +0000 |
commit | 78869703a8bf08bfa4e8f19b26dcf877949b0ad2 (patch) | |
tree | a38ce3eaa0ff8fbab4f8d77c4a1a00538425b52c /org.aspectj.ajdt.core/testsrc | |
parent | 4af623820a169e3179f448da0c089a82e156c94d (diff) | |
download | aspectj-78869703a8bf08bfa4e8f19b26dcf877949b0ad2.tar.gz aspectj-78869703a8bf08bfa4e8f19b26dcf877949b0ad2.zip |
Fixed 39626: Added AsmBuilderTest class that tests handling for this and related null parameters.
Diffstat (limited to 'org.aspectj.ajdt.core/testsrc')
2 files changed, 70 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java index 25d0f40ec..e17a5e542 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjdtBuilderTests.java @@ -22,6 +22,7 @@ public class AjdtBuilderTests extends TestCase { TestSuite suite = new TestSuite(AjdtBuilderTests.class.getName()); //$JUnit-BEGIN$ suite.addTestSuite(AjBuildManagerTest.class); + suite.addTestSuite(AsmBuilderTest.class); //$JUnit-END$ return suite; } diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AsmBuilderTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AsmBuilderTest.java new file mode 100644 index 000000000..759dbcb82 --- /dev/null +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AsmBuilderTest.java @@ -0,0 +1,69 @@ +/* ******************************************************************* + * 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 Common Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * PARC initial implementation + * ******************************************************************/ + + +package org.aspectj.ajdt.internal.core.builder; + +import java.util.EmptyStackException; + +import junit.framework.*; + +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.ast.LocalTypeDeclaration; +import org.eclipse.jdt.internal.compiler.env.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; + +public class AsmBuilderTest extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite(AsmBuilderTest.class.getName()); + //$JUnit-BEGIN$ + suite.addTestSuite(AsmBuilderTest.class); + //$JUnit-END$ + return suite; + } + + /** + * Test for bug#39626 + */ + public void testNullHandlingOfVisit() { + ICompilationUnit cu = new ICompilationUnit() { + public char[] getContents() { + return null; + } + + public char[] getMainTypeName() { + return null; + } + + public char[][] getPackageName() { + return null; + } + + public char[] getFileName() { + return null; + } + + }; + LocalTypeDeclaration local = new LocalTypeDeclaration(new CompilationResult(cu, 0, 0, 0)); + local.name = new char[2]; + BlockScope scope = null; + + try { + new AsmBuilder(new CompilationResult(cu, 0, 0, 0)).visit(local, scope); + } catch (Exception e) { + assertTrue(e instanceof EmptyStackException); + } + } + +} |