summaryrefslogtreecommitdiff
path: root/test/junit/net/sf/antcontrib/cpptasks/types
diff options
context:
space:
mode:
Diffstat (limited to 'test/junit/net/sf/antcontrib/cpptasks/types')
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/CVS/Entries4
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/CVS/Repository1
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/CVS/Root1
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/TestDefineArgument.java124
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/TestLibrarySet.java301
-rw-r--r--test/junit/net/sf/antcontrib/cpptasks/types/package.html28
6 files changed, 0 insertions, 459 deletions
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Entries b/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Entries
deleted file mode 100644
index 6e6e9f1..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Entries
+++ /dev/null
@@ -1,4 +0,0 @@
-/TestDefineArgument.java/1.8/Sat Feb 28 19:04:47 2004//
-/TestLibrarySet.java/1.14/Thu Apr 22 08:06:55 2004//
-/package.html/1.1/Fri Apr 16 04:04:11 2004//
-D
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Repository b/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Repository
deleted file mode 100644
index 95fa881..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
-cpptasks/test/junit/net/sf/antcontrib/cpptasks/types
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Root b/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Root
deleted file mode 100644
index 5e83ed6..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
-:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ant-contrib
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/TestDefineArgument.java b/test/junit/net/sf/antcontrib/cpptasks/types/TestDefineArgument.java
deleted file mode 100644
index e5b53ee..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/TestDefineArgument.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-import junit.framework.TestCase;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-/**
- * Tests for the DefineArgument class
- */
-public class TestDefineArgument extends TestCase {
- public TestDefineArgument(String name) {
- super(name);
- }
- public void testIsActive1() {
- DefineArgument arg = new DefineArgument();
- Project project = new Project();
- try {
- boolean isActive = arg.isActive(project);
- } catch (BuildException ex) {
- return;
- }
- fail("isActive should throw exception if name is not set");
- }
- public void testIsActive2() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- project.setProperty("cond", "");
- arg.setIf("cond");
- assertTrue(arg.isActive(project));
- }
- public void testIsActive3() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- arg.setIf("cond");
- assertTrue(!arg.isActive(project));
- }
- public void testIsActive4() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- project.setProperty("cond", "false");
- arg.setIf("cond");
- try {
- boolean isActive = arg.isActive(project);
- } catch (BuildException ex) {
- return;
- }
- fail("Should throw exception for suspicious value");
- }
- public void testIsActive5() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- project.setProperty("cond", "");
- arg.setUnless("cond");
- assertTrue(!arg.isActive(project));
- }
- public void testIsActive6() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- arg.setUnless("cond");
- assertTrue(arg.isActive(project));
- }
- public void testIsActive7() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- project.setProperty("cond", "false");
- arg.setUnless("cond");
- try {
- boolean isActive = arg.isActive(project);
- } catch (BuildException ex) {
- return;
- }
- fail("Should throw exception for suspicious value");
- }
- public void testIsActive8() {
- DefineArgument arg = new DefineArgument();
- arg.setName("TEST");
- Project project = new Project();
- project.setProperty("cond", "");
- arg.setIf("cond");
- arg.setUnless("cond");
- assertTrue(!arg.isActive(project));
- }
- public void testMerge() {
- UndefineArgument[] base = new UndefineArgument[2];
- UndefineArgument[] specific = new UndefineArgument[2];
- base[0] = new DefineArgument();
- base[0].setName("foo");
- base[1] = new UndefineArgument();
- base[1].setName("hello");
- specific[0] = new DefineArgument();
- specific[0].setName("hello");
- specific[1] = new UndefineArgument();
- specific[1].setName("world");
- UndefineArgument[] merged = UndefineArgument.merge(base, specific);
- assertEquals(3, merged.length);
- assertEquals("foo", merged[0].getName());
- assertEquals(true, merged[0].isDefine());
- assertEquals("hello", merged[1].getName());
- assertEquals(true, merged[1].isDefine());
- assertEquals("world", merged[2].getName());
- assertEquals(false, merged[2].isDefine());
- }
-}
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/TestLibrarySet.java b/test/junit/net/sf/antcontrib/cpptasks/types/TestLibrarySet.java
deleted file mode 100644
index ce0d712..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/TestLibrarySet.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.sf.antcontrib.cpptasks.types;
-
-import java.io.File;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-import net.sf.antcontrib.cpptasks.CUtil;
-import net.sf.antcontrib.cpptasks.MockBuildListener;
-import net.sf.antcontrib.cpptasks.MockFileCollector;
-import net.sf.antcontrib.cpptasks.compiler.Linker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioLinker;
-import net.sf.antcontrib.cpptasks.devstudio.DevStudioLibrarian;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-
-/**
- * Tests for the LibrarySet class.
- */
-public class TestLibrarySet
- extends TestCase {
-
- /**
- * Constructor.
- *
- * @param name
- * test name
- */
- public TestLibrarySet(final String name) {
- super(name);
- }
-
- /**
- * Evaluate isActive when "if" specifies a property that is set.
- */
- public final void testIsActive1() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- project.setProperty("windows", "");
- libset.setProject(project);
- libset.setIf("windows");
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("kernel32");
- libset.setLibs(libs);
- boolean isActive = libset.isActive(project);
- assertTrue(isActive);
- }
-
- /**
- * Evaluate isActive when "if" specifies a property whose value suggests the
- * user thinks the value is significant.
- *
- */
- public final void testIsActive2() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- //
- // setting the value to false should throw
- // exception to warn user that they are misusing if
- //
- project.setProperty("windows", "false");
- libset.setIf("windows");
- try {
- boolean isActive = libset.isActive(project);
- } catch (BuildException ex) {
- return;
- }
- fail();
- }
-
- /**
- * Evaluate isActive when "if" specifies a property that is not set.
- */
- public final void testIsActive3() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- libset.setIf("windows");
- boolean isActive = libset.isActive(project);
- assertTrue(!isActive);
- }
-
- /**
- * Evaluate isActive when "unless" specifies a property that is set.
- *
- */
- public final void testIsActive4() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- project.setProperty("windows", "");
- libset.setUnless("windows");
- boolean isActive = libset.isActive(project);
- assertTrue(!isActive);
- }
-
- /**
- * Evaluate isActive when "unless" specifies a property whose value suggests
- * the user thinks the value is significant.
- *
- */
- public final void testIsActive5() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- //
- // setting the value to false should throw
- // exception to warn user that they are misusing if
- //
- project.setProperty("windows", "false");
- libset.setUnless("windows");
- try {
- boolean isActive = libset.isActive(project);
- } catch (BuildException ex) {
- return;
- }
- fail();
- }
-
- /**
- * Evaluate isActive when "unless" specifies a property that is not set.
- */
- public final void testIsActive6() {
- LibrarySet libset = new LibrarySet();
- Project project = new Project();
- libset.setProject(project);
- libset.setUnless("windows");
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("kernel32");
- libset.setLibs(libs);
- boolean isActive = libset.isActive(project);
- assertTrue(isActive);
- }
-
- /**
- * The libs parameter should not end with .lib, .so, .a etc New behavior is
- * to warn if it ends in a suspicious extension.
- */
- public final void testLibContainsDot() {
- LibrarySet libset = new LibrarySet();
- Project p = new Project();
- MockBuildListener listener = new MockBuildListener();
- p.addBuildListener(listener);
- libset.setProject(p);
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("mylib1.1");
- libset.setLibs(libs);
- assertEquals(0, listener.getMessageLoggedEvents().size());
- }
-
- /**
- * The libs parameter should not end with .lib, .so, .a etc however the
- * previous test would cause a build exception for any library containing
- * periods. Now logs warning message.
- */
- public final void testLibContainsDotLib() {
- LibrarySet libset = new LibrarySet();
- Project p = new Project();
- MockBuildListener listener = new MockBuildListener();
- p.addBuildListener(listener);
- libset.setProject(p);
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder(
- "mylib1.lib");
- libset.setLibs(libs);
- assertEquals(1, listener.getMessageLoggedEvents().size());
- }
-
- /**
- * Use of a libset or syslibset without a libs attribute should log a
- * warning message.
- */
- public final void testLibNotSpecified() {
- LibrarySet libset = new LibrarySet();
- Project p = new Project();
- MockBuildListener listener = new MockBuildListener();
- p.addBuildListener(listener);
- libset.setProject(p);
- boolean isActive = libset.isActive(p);
- assertEquals(false, isActive);
- assertEquals(1, listener.getMessageLoggedEvents().size());
- }
-
- /**
- * this threw an exception prior to 2002-09-05 and started to throw one
- * again 2002-11-19 up to 2002-12-11.
- */
- public final void testShortLibName() {
- LibrarySet libset = new LibrarySet();
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder("li");
- libset.setProject(new Project());
- libset.setLibs(libs);
- }
-
- /**
- * The libs parameter should not end with .lib, .so, .a etc however the
- * previous test would cause a build exception for any library containing
- * periods. Now logs warning message.
- */
- public final void testStartsWithLib() {
- LibrarySet libset = new LibrarySet();
- Project p = new Project();
- MockBuildListener listener = new MockBuildListener();
- p.addBuildListener(listener);
- libset.setProject(p);
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder(
- "libmylib1");
- libset.setLibs(libs);
- assertEquals(1, listener.getMessageLoggedEvents().size());
- }
-
- /**
- * This test creates two "fake" libraries in the temporary directory and
- * check how many are visited.
- *
- * @param linker linker
- * @param expected expected number of visited files
- * @throws IOException
- * if unable to write to temporary directory or delete temporary
- * files
- */
- public final void testVisitFiles(final Linker linker,
- final int expected)
- throws IOException {
- LibrarySet libset = new LibrarySet();
- Project p = new Project();
- MockBuildListener listener = new MockBuildListener();
- p.addBuildListener(listener);
- libset.setProject(p);
- //
- // create temporary files named cpptasksXXXXX.lib
- //
- File lib1 = File.createTempFile("cpptasks", ".lib");
- String lib1Name = lib1.getName();
- lib1Name = lib1Name.substring(0, lib1Name.indexOf(".lib"));
- File lib2 = File.createTempFile("cpptasks", ".lib");
- File baseDir = lib1.getParentFile();
-
- // set the dir attribute to the temporary directory
- libset.setDir(baseDir);
- // set libs to the file name without the suffix
- CUtil.StringArrayBuilder libs = new CUtil.StringArrayBuilder(lib1Name);
- libset.setLibs(libs);
-
- //
- // collect all files visited
- MockFileCollector collector = new MockFileCollector();
- libset.visitLibraries(p, linker, new File[0], collector);
-
- //
- // get the canonical paths for the initial and visited libraries
- String expectedCanonicalPath = lib1.getCanonicalPath();
- String actualCanonicalPath = null;
- if (collector.size() == 1) {
- actualCanonicalPath = new File(collector.getBaseDir(0), collector
- .getFileName(0)).getCanonicalPath();
- }
- //
- // delete the temporary files
- lib1.delete();
- lib2.delete();
- // was there only one match
- assertEquals(expected, collector.size());
- if (expected == 1) {
- // is its canonical path as expected
- assertEquals(expectedCanonicalPath, actualCanonicalPath);
- }
- }
-
- /**
- * Run testVisitFiles with the MSVC Linker
- * expect one matching file.
- *
- * @throws IOException if unable to create or delete temporary file
- */
- public final void testLinkerVisitFiles() throws IOException {
- Linker linker = DevStudioLinker.getInstance();
- testVisitFiles(linker, 1);
- }
-
- /**
- * Run testVisitFiles with the MSVC Linker
- * expect one matching file.
- *
- * @throws IOException if unable to create or delete temporary file
- */
- public final void testLibrarianVisitFiles() throws IOException {
- Linker linker = DevStudioLibrarian.getInstance();
- testVisitFiles(linker, 0);
- }
-
-}
diff --git a/test/junit/net/sf/antcontrib/cpptasks/types/package.html b/test/junit/net/sf/antcontrib/cpptasks/types/package.html
deleted file mode 100644
index e5efbc4..0000000
--- a/test/junit/net/sf/antcontrib/cpptasks/types/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-Copyright 2004 The Ant-Contrib project
-
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License. You may obtain a copy of
- the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations under
- the License.
-
--->
-</head>
-<body bgcolor="white">
-
-JUnit tests for the net.sf.antcontrib.cpptasks.types package.
-
-</body>
-</html>
-