From ec9ac363b0379ce8bb8c0783ab338d8ffaa9da02 Mon Sep 17 00:00:00 2001 From: mkersten Date: Thu, 11 Mar 2004 19:22:42 +0000 Subject: Added support for inheritance documentation, test coverage. --- .../org/aspectj/tools/ajdoc/AjdocModuleTests.java | 29 +++++++++++++ .../org/aspectj/tools/ajdoc/ExecutionTestCase.java | 50 ++++++++++++++++++++++ .../testsrc/org/aspectj/tools/ajdoc/MainTest.java | 46 -------------------- .../org/aspectj/tools/ajdoc/MainTestCase.java | 43 +++++++++++++++++++ 4 files changed, 122 insertions(+), 46 deletions(-) create mode 100644 ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java create mode 100644 ajdoc/testsrc/org/aspectj/tools/ajdoc/ExecutionTestCase.java delete mode 100644 ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java create mode 100644 ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTestCase.java (limited to 'ajdoc/testsrc/org') diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java new file mode 100644 index 000000000..f1df75767 --- /dev/null +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocModuleTests.java @@ -0,0 +1,29 @@ +/* ******************************************************************* + * Copyright (c) 2003 Contributors. + * 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: + * Mik Kersten initial implementation + * ******************************************************************/ + package org.aspectj.tools.ajdoc; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Mik Kersten + */ +public class AjdocModuleTests { + public static Test suite() { + TestSuite suite = new TestSuite("Test for org.aspectj.tools.ajdoc"); + //$JUnit-BEGIN$ + suite.addTestSuite(MainTestCase.class); + suite.addTestSuite(ExecutionTestCase.class); + //$JUnit-END$ + return suite; + } +} diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/ExecutionTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/ExecutionTestCase.java new file mode 100644 index 000000000..14ee913bf --- /dev/null +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/ExecutionTestCase.java @@ -0,0 +1,50 @@ +/* ******************************************************************* + * Copyright (c) 2003 Contributors. + * 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: + * Mik Kersten initial implementation + * ******************************************************************/ + +package org.aspectj.tools.ajdoc; + +import java.io.File; +import java.io.PrintStream; +import java.io.PrintWriter; + +import junit.framework.TestCase; + +import org.aspectj.bridge.Version; +import org.aspectj.util.StreamPrintWriter; + +/** + * @author Mik Kersten + */ +public class ExecutionTestCase extends TestCase { + + public void testVersionMatch() { + String ajdocVersion = Main.getVersion(); + String compilerVersion = Version.text; + assertTrue("version check", ajdocVersion.endsWith(compilerVersion)); + } + + public void testFailingBuild() { + File file1 = new File("testdata/failing-build/Fail.java"); + String[] args = { file1.getAbsolutePath() }; + + org.aspectj.tools.ajdoc.Main.main(args); + assertTrue(Main.hasAborted()); + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } +} diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java deleted file mode 100644 index 6404ae25b..000000000 --- a/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2003 Contributors. - * 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: - * Mik Kersten initial implementation - * ******************************************************************/ - package org.aspectj.tools.ajdoc; - -import java.io.File; - -import junit.framework.TestCase; - -/** - * @author Mik Kersten - */ -public class MainTest extends TestCase { - - - public void testRun() { - -// System.err.println(new File("testdata/figures-demo").exists()); - File sourcepath = new File("testdata/simple/foo/ClassA.java"); - File outdir = new File("testdata/simple/doc"); - - String[] args = { "-d", outdir.getAbsolutePath(), sourcepath.getAbsolutePath() }; - -// String[] args = { "-sourcepath", sourcepath.getAbsolutePath(), "figures" }; - org.aspectj.tools.ajdoc.Main.main(args); - - assertTrue(true); - } - - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } -} diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTestCase.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTestCase.java new file mode 100644 index 000000000..0863a04b0 --- /dev/null +++ b/ajdoc/testsrc/org/aspectj/tools/ajdoc/MainTestCase.java @@ -0,0 +1,43 @@ +/* ******************************************************************* + * Copyright (c) 2003 Contributors. + * 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: + * Mik Kersten initial implementation + * ******************************************************************/ + package org.aspectj.tools.ajdoc; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * @author Mik Kersten + */ +public class MainTestCase extends TestCase { + + public void testSimpleExample() { + +// System.err.println(new File("testdata/figures-demo").exists()); + File file1 = new File("testdata/simple/foo/ClassA.java"); + File file2 = new File("testdata/simple/foo/InterfaceI.java"); + File outdir = new File("testdata/simple/doc"); + + String[] args = { "-d", outdir.getAbsolutePath(), file1.getAbsolutePath(), file2.getAbsolutePath() }; + org.aspectj.tools.ajdoc.Main.main(args); + + assertTrue(true); + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } +} -- cgit v1.2.3