diff options
author | aclement <aclement> | 2004-08-18 10:33:07 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-08-18 10:33:07 +0000 |
commit | 5b902242b00ffaf3105335f231e45291e7d09320 (patch) | |
tree | 4d9bff2b8bd2a1beb1385d9e45c99509c6637415 /org.aspectj.ajdt.core/testsrc | |
parent | 8837d683dc44f6c380b25359d7ce90b9a17e8a66 (diff) | |
download | aspectj-5b902242b00ffaf3105335f231e45291e7d09320.tar.gz aspectj-5b902242b00ffaf3105335f231e45291e7d09320.zip |
Fix for Bugzilla Bug 71076
Missing Javadoc comments that aren't missing
Diffstat (limited to 'org.aspectj.ajdt.core/testsrc')
2 files changed, 75 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java index 80710268c..5f9d266a9 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java @@ -29,6 +29,7 @@ public class AjdtBatchTests extends TestCase { suite.addTestSuite(PerformanceTestCase.class); suite.addTestSuite(ImageTestCase.class); suite.addTestSuite(MultipleCompileTestCase.class); + suite.addTestSuite(JavadocTest.class); // XXX suite.addTestSuite(VerifyWeaveTestCase.class); //suite.addTestSuite(WorkingCommandTestCase.class); //$JUnit-END$ diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java new file mode 100644 index 000000000..957e0458c --- /dev/null +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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: + * Andy Clement - initial implementation + *******************************************************************************/ +package org.aspectj.ajdt.internal.compiler.batch; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.aspectj.bridge.IMessage; +import org.aspectj.tools.ajc.AjcTestCase; +import org.aspectj.tools.ajc.CompilationResult; + + +public class JavadocTest extends AjcTestCase { + public static final String PROJECT_DIR = "javadoc"; + + private File baseDir; + + protected void setUp() throws Exception { + super.setUp(); + baseDir = new File("../org.aspectj.ajdt.core/testdata",PROJECT_DIR); + } + + /** + * Aim: Check javadoc warning that appear are appropriate + * + * ajc -warn:allJavadoc World.java + * + */ + public void testMissingJavadoc () { + String[] args = new String[] {"World.java","-warn:allJavadoc"}; + + List warningMessages = new ArrayList(); + // These warnings are against public textX() methods declared in the World.java + // type. These test methods are spread between AJ constructuts, meaning + // if someone messes up and the javadoc is not associated with the aspectj + // construct then it will associated by accident with one of the testX() methods. + // By checking we get a warning against every testX() method, we are verifying + // that the javadoc is being attached to the aspectj constructs. + warningMessages.add(new Message(10,"Missing comment for public declaration")); + warningMessages.add(new Message(18,"Missing comment for public declaration")); + warningMessages.add(new Message(28,"Missing comment for public declaration")); + warningMessages.add(new Message(36,"Missing comment for public declaration")); + warningMessages.add(new Message(44,"Missing comment for public declaration")); + warningMessages.add(new Message(53,"Missing comment for public declaration")); + warningMessages.add(new Message(61,"Missing comment for public declaration")); + warningMessages.add(new Message(69,"Missing comment for public declaration")); + MessageSpec spec = new MessageSpec(warningMessages,null); + + CompilationResult result = ajc(baseDir,args); + assertMessages(result,spec); + +// dump(result.getWarningMessages()); +// System.err.println("-----------\n"+ajc.getLastCompilationResult().getStandardError()); +// List l = result.getWarningMessages(); +// IMessage m = ((IMessage)l.get(0)); + } + + private void dump(List l) { + for (Iterator iter = l.iterator(); iter.hasNext();) { + IMessage element = (IMessage) iter.next(); + System.err.println("Warning: "+element); + } + } +} |