From b03f055da64b4bc24b0ccfc5a439827131016226 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Thu, 5 Jul 2007 21:41:16 +0000 Subject: Updated extra files --- .../net/sf/antcontrib/cpptasks/gcc/CVS/Entries | 6 - .../net/sf/antcontrib/cpptasks/gcc/CVS/Repository | 1 - test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Root | 1 - .../cpptasks/gcc/TestAbstractArLibrarian.java | 79 ------- .../cpptasks/gcc/TestAbstractLdLinker.java | 247 --------------------- .../antcontrib/cpptasks/gcc/TestGccCCompiler.java | 80 ------- .../cpptasks/gcc/TestGccCompatibleCCompiler.java | 105 --------- .../sf/antcontrib/cpptasks/gcc/TestGccLinker.java | 80 ------- 8 files changed, 599 deletions(-) delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Entries delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Repository delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Root delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractArLibrarian.java delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCCompiler.java delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCompatibleCCompiler.java delete mode 100644 test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccLinker.java (limited to 'test/junit/net/sf/antcontrib/cpptasks/gcc') diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Entries b/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Entries deleted file mode 100644 index 2ddb545..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Entries +++ /dev/null @@ -1,6 +0,0 @@ -/TestAbstractArLibrarian.java/1.6/Tue May 11 03:50:12 2004// -/TestAbstractLdLinker.java/1.7/Wed Apr 21 21:46:50 2004// -/TestGccCCompiler.java/1.7/Sat Feb 28 19:04:47 2004// -/TestGccCompatibleCCompiler.java/1.3/Sat Feb 28 19:04:47 2004// -/TestGccLinker.java/1.5/Tue May 11 03:50:12 2004// -D diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Repository b/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Repository deleted file mode 100644 index 9a87a17..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -cpptasks/test/junit/net/sf/antcontrib/cpptasks/gcc diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Root b/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Root deleted file mode 100644 index 5e83ed6..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ant-contrib diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractArLibrarian.java b/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractArLibrarian.java deleted file mode 100644 index 0fc8449..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractArLibrarian.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * Copyright 2003-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.gcc; -import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; -import net.sf.antcontrib.cpptasks.compiler.TestAbstractLinker; -/** - * Tests for classes that derive from AbstractArLibrarian - * - * @author CurtA - */ -public class TestAbstractArLibrarian extends TestAbstractLinker { - /** - * Constructor - * - * @param name - * test name - * @see junit.framework.TestCase#TestCase(String) - */ - public TestAbstractArLibrarian(String name) { - super(name); - } - /** - * Creates item under test @returns item under test - * - * @see net.sf.antcontrib.cpptasks.compiler.TestAbstractProcessor#create() - */ - protected AbstractProcessor create() { - return GccLibrarian.getInstance(); - } - /** - * Override of - * - * @see net.sf.antcontrib.cpptasks.compiler.TestAbstractProcessor#testBid() - */ - public void testBid() { - AbstractProcessor compiler = create(); - int bid = compiler.bid("c:/foo\\bar\\hello.o"); - assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, bid); - } - public void testGetIdentfier() { - AbstractProcessor processor = create(); - String id = processor.getIdentifier(); - assertTrue(id.indexOf("ar") >= 0); - } - /** - * Tests for library patterns - * - * See patch [ 676276 ] Enhanced support for Mac OS X - */ - public void testGetLibraryPatterns() { - String[] libnames = new String[]{"foo"}; - String[] patterns = ((AbstractArLibrarian) create()) - .getLibraryPatterns(libnames, null); - assertEquals(0, patterns.length); - } - /** - * Tests output file for ar library - * - * See bug [ 687732 ] Filenames for gcc static library does start with lib - */ - public void testOutputFileName() { - String[] outputFiles = GccLibrarian.getInstance().getOutputFileNames("x", null); - assertEquals("libx.a", outputFiles[0]); - } -} diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java b/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java deleted file mode 100644 index 63996c5..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestAbstractLdLinker.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * - * Copyright 2003-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.gcc; -import java.io.File; -import java.util.Vector; - -import junit.framework.TestCase; -import net.sf.antcontrib.cpptasks.CCTask; -import net.sf.antcontrib.cpptasks.CUtil; -import net.sf.antcontrib.cpptasks.OutputTypeEnum; -import net.sf.antcontrib.cpptasks.compiler.LinkType; -import net.sf.antcontrib.cpptasks.types.LibrarySet; -import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum; -/** - * Test ld linker adapter abstract base class - * - * Override create to test concrete compiler implementions - */ -public class TestAbstractLdLinker extends TestCase { - private final String realOSName; - public TestAbstractLdLinker(String name) { - super(name); - realOSName = System.getProperty("os.name"); - } - protected AbstractLdLinker getLinker() { - return GccLinker.getInstance(); - } - protected void tearDown() throws java.lang.Exception { - System.setProperty("os.name", realOSName); - } - /** - * Checks for proper arguments for plugin generation on Darwin - * - * See [ 676276 ] Enhanced support for Mac OS X - */ - public void testAddImpliedArgsDarwinPlugin() { - System.setProperty("os.name", "Mac OS X"); - AbstractLdLinker linker = getLinker(); - Vector args = new Vector(); - LinkType pluginType = new LinkType(); - OutputTypeEnum pluginOutType = new OutputTypeEnum(); - pluginOutType.setValue("plugin"); - pluginType.setOutputType(pluginOutType); - linker.addImpliedArgs(false, pluginType, args); - assertEquals(1, args.size()); - assertEquals("-bundle", args.elementAt(0)); - } - /** - * Checks for proper arguments for shared generation on Darwin - * - * See [ 676276 ] Enhanced support for Mac OS X - */ - public void testAddImpliedArgsDarwinShared() { - System.setProperty("os.name", "Mac OS X"); - AbstractLdLinker linker = getLinker(); - Vector args = new Vector(); - LinkType pluginType = new LinkType(); - OutputTypeEnum pluginOutType = new OutputTypeEnum(); - pluginOutType.setValue("shared"); - pluginType.setOutputType(pluginOutType); - linker.addImpliedArgs(false, pluginType, args); - assertEquals(2, args.size()); - assertEquals("-prebind", args.elementAt(0)); - assertEquals("-dynamiclib", args.elementAt(1)); - } - /** - * Checks for proper arguments for plugin generation on Darwin - * - * See [ 676276 ] Enhanced support for Mac OS X - */ - public void testAddImpliedArgsNonDarwinPlugin() { - System.setProperty("os.name", "VAX/VMS"); - AbstractLdLinker linker = getLinker(); - Vector args = new Vector(); - LinkType pluginType = new LinkType(); - OutputTypeEnum pluginOutType = new OutputTypeEnum(); - pluginOutType.setValue("plugin"); - pluginType.setOutputType(pluginOutType); - linker.addImpliedArgs(false, pluginType, args); - assertEquals(1, args.size()); - assertEquals("-shared", args.elementAt(0)); - } - /** - * Checks for proper arguments for shared generation on Darwin - * - * See [ 676276 ] Enhanced support for Mac OS X - */ - public void testAddImpliedArgsNonDarwinShared() { - System.setProperty("os.name", "VAX/VMS"); - AbstractLdLinker linker = getLinker(); - Vector args = new Vector(); - LinkType pluginType = new LinkType(); - OutputTypeEnum pluginOutType = new OutputTypeEnum(); - pluginOutType.setValue("shared"); - pluginType.setOutputType(pluginOutType); - linker.addImpliedArgs(false, pluginType, args); - assertEquals(1, args.size()); - assertEquals("-shared", args.elementAt(0)); - } - public void testAddLibrarySetDirSwitch() { - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setDir(new File("/foo")); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - String libdirSwitch = (String) endargs.elementAt(0); - assertEquals(libdirSwitch.substring(0, 2), "-L"); - // - // can't have space after -L or will break Mac OS X - // - assertTrue(!libdirSwitch.substring(2, 3).equals(" ")); - assertEquals(libdirSwitch.substring(libdirSwitch.length() - 3), "foo"); - } - public void testAddLibrarySetLibSwitch() { - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setDir(new File("/foo")); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - assertEquals("-lbart", (String) endargs.elementAt(1)); - assertEquals("-lcart", (String) endargs.elementAt(2)); - assertEquals("-ldart", (String) endargs.elementAt(3)); - assertEquals(endargs.size(), 4); - } - public void testAddLibrarySetLibFrameworkNonDarwin() { - System.setProperty("os.name", "VAX/VMS"); - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setDir(new File("/foo")); - LibraryTypeEnum libType = new LibraryTypeEnum(); - libType.setValue("framework"); - sets[0].setType(libType); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - assertEquals("-L", ((String) endargs.elementAt(0)).substring(0, 2)); - assertEquals("-Bdynamic", (String) endargs.elementAt(1)); - assertEquals("-lbart", (String) endargs.elementAt(2)); - assertEquals("-lcart", (String) endargs.elementAt(3)); - assertEquals("-ldart", (String) endargs.elementAt(4)); - assertEquals(endargs.size(), 5); - } - public void testAddLibrarySetLibFrameworkDarwin() { - System.setProperty("os.name", "Mac OS X"); - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setDir(new File("/foo")); - LibraryTypeEnum libType = new LibraryTypeEnum(); - libType.setValue("framework"); - sets[0].setType(libType); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - assertEquals("-F", ((String) endargs.elementAt(0)).substring(0, 2)); - assertEquals("-framework bart", (String) endargs.elementAt(1)); - assertEquals("-framework cart", (String) endargs.elementAt(2)); - assertEquals("-framework dart", (String) endargs.elementAt(3)); - assertEquals(endargs.size(), 4); - } - public void testAddLibraryStatic() { - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{ - new LibrarySet(), - new LibrarySet(), - new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart")); - sets[1].setProject(new org.apache.tools.ant.Project()); - sets[1].setLibs(new CUtil.StringArrayBuilder("cart")); - LibraryTypeEnum libType = new LibraryTypeEnum(); - libType.setValue("static"); - sets[1].setType(libType); - sets[2].setProject(new org.apache.tools.ant.Project()); - sets[2].setLibs(new CUtil.StringArrayBuilder("dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - assertEquals("-lbart", (String) endargs.elementAt(0)); - assertEquals("-Bstatic", (String) endargs.elementAt(1)); - assertEquals("-lcart", (String) endargs.elementAt(2)); - assertEquals("-Bdynamic", (String) endargs.elementAt(3)); - assertEquals("-ldart", (String) endargs.elementAt(4)); - assertEquals(endargs.size(), 5); - } - public void testLibReturnValue() { - AbstractLdLinker linker = getLinker(); - CCTask task = new CCTask(); - LibrarySet[] sets = new LibrarySet[]{new LibrarySet()}; - /* throws an Exception in setLibs otherwise */ - sets[0].setProject(new org.apache.tools.ant.Project()); - sets[0].setDir(new File("/foo")); - sets[0].setLibs(new CUtil.StringArrayBuilder("bart,cart,dart")); - Vector preargs = new Vector(); - Vector midargs = new Vector(); - Vector endargs = new Vector(); - String[] rc = linker.addLibrarySets(task, sets, preargs, midargs, - endargs); - assertEquals(3, rc.length); - assertEquals("bart", rc[0]); - assertEquals("cart", rc[1]); - assertEquals("dart", rc[2]); - } -} diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCCompiler.java b/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCCompiler.java deleted file mode 100644 index 3abe409..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCCompiler.java +++ /dev/null @@ -1,80 +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.gcc; -import java.io.File; - -import net.sf.antcontrib.cpptasks.compiler.AbstractProcessor; -import net.sf.antcontrib.cpptasks.parser.CParser; -import net.sf.antcontrib.cpptasks.parser.FortranParser; -import net.sf.antcontrib.cpptasks.parser.Parser; -/** - * Test gcc compiler adapter - * - */ -public class TestGccCCompiler extends TestGccCompatibleCCompiler { - public TestGccCCompiler(String name) { - super(name); - } - protected GccCompatibleCCompiler create() { - return GccCCompiler.getInstance(); - } - public void testBidObjectiveAssembly() { - GccCCompiler compiler = GccCCompiler.getInstance(); - assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler - .bid("foo.s")); - } - public void testBidObjectiveC() { - GccCCompiler compiler = GccCCompiler.getInstance(); - assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler - .bid("foo.m")); - } - public void testBidObjectiveCpp() { - GccCCompiler compiler = GccCCompiler.getInstance(); - assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler - .bid("foo.mm")); - } - public void testBidPreprocessedCpp() { - GccCCompiler compiler = GccCCompiler.getInstance(); - assertEquals(AbstractProcessor.DEFAULT_PROCESS_BID, compiler - .bid("foo.ii")); - } - public void testCreateCParser1() { - Parser parser = GccCCompiler.getInstance().createParser( - new File("foo.c")); - assertTrue(parser instanceof CParser); - } - public void testCreateCParser2() { - Parser parser = GccCCompiler.getInstance().createParser( - new File("foo.")); - assertTrue(parser instanceof CParser); - } - public void testCreateCParser3() { - Parser parser = GccCCompiler.getInstance() - .createParser(new File("foo")); - assertTrue(parser instanceof CParser); - } - public void testCreateFortranParser1() { - Parser parser = GccCCompiler.getInstance().createParser( - new File("foo.f")); - assertTrue(parser instanceof FortranParser); - } - public void testCreateFortranParser2() { - Parser parser = GccCCompiler.getInstance().createParser( - new File("foo.FoR")); - assertTrue(parser instanceof FortranParser); - } -} diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCompatibleCCompiler.java b/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCompatibleCCompiler.java deleted file mode 100644 index 68fab2e..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccCompatibleCCompiler.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * - * Copyright 2003-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.gcc; -import java.util.Vector; - -import junit.framework.TestCase; -/** - * Tests for gcc compatible compilers - * - * @author CurtA - */ -public abstract class TestGccCompatibleCCompiler extends TestCase { - /** - * Constructor - * - * @param name - * test case name - */ - public TestGccCompatibleCCompiler(String name) { - super(name); - } - /** - * Compiler creation method - * - * Must be overriden by extending classes - * - * @return GccCompatibleCCompiler - */ - protected abstract GccCompatibleCCompiler create(); - /** - * Tests command lines switches for warning = 0 - */ - public void testWarningLevel0() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 0); - assertEquals(1, args.size()); - assertEquals("-w", args.elementAt(0)); - } - /** - * Tests command lines switches for warning = 1 - */ - public void testWarningLevel1() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 1); - assertEquals(0, args.size()); - } - /** - * Tests command lines switches for warning = 2 - */ - public void testWarningLevel2() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 2); - assertEquals(0, args.size()); - } - /** - * Tests command lines switches for warning = 3 - */ - public void testWarningLevel3() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 3); - assertEquals(1, args.size()); - assertEquals("-Wall", args.elementAt(0)); - } - /** - * Tests command lines switches for warning = 4 - */ - public void testWarningLevel4() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 4); - assertEquals(2, args.size()); - assertEquals("-W", args.elementAt(0)); - assertEquals("-Wall", args.elementAt(1)); - } - /** - * Tests command lines switches for warning = 5 - */ - public void testWarningLevel5() { - GccCompatibleCCompiler compiler = create(); - Vector args = new Vector(); - compiler.addWarningSwitch(args, 5); - assertEquals(3, args.size()); - assertEquals("-Werror", args.elementAt(0)); - assertEquals("-W", args.elementAt(1)); - assertEquals("-Wall", args.elementAt(2)); - } -} diff --git a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccLinker.java b/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccLinker.java deleted file mode 100644 index ee3ad8b..0000000 --- a/test/junit/net/sf/antcontrib/cpptasks/gcc/TestGccLinker.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * Copyright 2003-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.gcc; -import junit.framework.TestCase; -import net.sf.antcontrib.cpptasks.OutputTypeEnum; -import net.sf.antcontrib.cpptasks.compiler.LinkType; -import net.sf.antcontrib.cpptasks.compiler.Linker; -/** - * @author CurtA - */ -public class TestGccLinker extends TestCase { - private final String realOSName; - /** - * Constructor - * - * @param test - * name - */ - public TestGccLinker(String name) { - super(name); - realOSName = System.getProperty("os.name"); - } - protected void tearDown() throws java.lang.Exception { - System.setProperty("os.name", realOSName); - } - public void testGetLinkerDarwinPlugin() { - System.setProperty("os.name", "Mac OS X"); - GccLinker linker = GccLinker.getInstance(); - OutputTypeEnum outputType = new OutputTypeEnum(); - outputType.setValue("plugin"); - LinkType linkType = new LinkType(); - linkType.setOutputType(outputType); - Linker pluginLinker = linker.getLinker(linkType); - assertEquals("libfoo.bundle", pluginLinker.getOutputFileNames("foo", null)[0]); - } - public void testGetLinkerDarwinShared() { - System.setProperty("os.name", "Mac OS X"); - GccLinker linker = GccLinker.getInstance(); - OutputTypeEnum outputType = new OutputTypeEnum(); - outputType.setValue("shared"); - LinkType linkType = new LinkType(); - linkType.setOutputType(outputType); - Linker sharedLinker = linker.getLinker(linkType); - assertEquals("libfoo.dylib", sharedLinker.getOutputFileNames("foo", null)[0]); - } - public void testGetLinkerNonDarwinPlugin() { - System.setProperty("os.name", "Microsoft Windows"); - GccLinker linker = GccLinker.getInstance(); - OutputTypeEnum outputType = new OutputTypeEnum(); - outputType.setValue("plugin"); - LinkType linkType = new LinkType(); - linkType.setOutputType(outputType); - Linker pluginLinker = linker.getLinker(linkType); - assertEquals("libfoo.so", pluginLinker.getOutputFileNames("foo", null)[0]); - } - public void testGetLinkerNonDarwinShared() { - System.setProperty("os.name", "Microsoft Windows"); - GccLinker linker = GccLinker.getInstance(); - OutputTypeEnum outputType = new OutputTypeEnum(); - outputType.setValue("shared"); - LinkType linkType = new LinkType(); - linkType.setOutputType(outputType); - Linker sharedLinker = linker.getLinker(linkType); - assertEquals("libfoo.so", sharedLinker.getOutputFileNames("foo", null)[0]); - } -} -- cgit v1.2.3