]> source.dussan.org Git - aspectj.git/commitdiff
tests for PR48650 partial workaround - ugh
authorwisberg <wisberg>
Thu, 27 Jan 2005 04:16:55 +0000 (04:16 +0000)
committerwisberg <wisberg>
Thu, 27 Jan 2005 04:16:55 +0000 (04:16 +0000)
tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java
tests/src/org/aspectj/systemtest/ajc150/SCCSFixTests.java [new file with mode: 0644]

index 9e38feb707d1c63638cbce5bb9df38517759fa87..286832e3d3bb333cdf38d48b43bc4f7ef08b9bbb 100644 (file)
@@ -24,6 +24,7 @@ public class AllTestsAspectJ150 {
                suite.addTestSuite(MigrationTests.class);
                suite.addTest(Ajc150Tests.suite());
                suite.addTestSuite(Ajc150TestsNoHarness.class); 
+        suite.addTestSuite(SCCSFixTests.class);
                
                // These are binary weaving tests
                suite.addTest(AccBridgeMethods.suite());
diff --git a/tests/src/org/aspectj/systemtest/ajc150/SCCSFixTests.java b/tests/src/org/aspectj/systemtest/ajc150/SCCSFixTests.java
new file mode 100644 (file)
index 0000000..46f319d
--- /dev/null
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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:
+ *     Wes Isberg - initial implementation
+ *******************************************************************************/
+
+package org.aspectj.systemtest.ajc150;
+
+import java.io.File;
+
+import org.aspectj.tools.ajc.AjcTestCase;
+import org.aspectj.tools.ajc.CompilationResult;
+import org.aspectj.util.FileUtil;
+
+/**
+ * SCCS/CVS directory fix.
+ * Would add to Ajc150TestsNoHarness, but can't share basedir/setup, etc.
+ */
+public class SCCSFixTests extends AjcTestCase {
+    File baseDir;
+    File sourceroot;
+
+    public void setUp() throws Exception {
+        super.setUp();
+        baseDir = FileUtil.getTempDir("BugFixTests");
+        sourceroot = new File(baseDir, "sourceroot");
+        sourceroot.mkdirs();
+    }
+    public void tearDown() {
+        FileUtil.deleteContents(baseDir);
+    }
+    /**
+     * @see org/aspectj/util/FileUtil.java 1.17
+     * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650
+     */
+    public void testSkipCVS() {
+        doTestSkip("CVS");
+    }
+
+    /**
+     * @see org/aspectj/util/FileUtil.java 1.17
+     * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650
+     */
+    public void testSkipSCCS() {
+        doTestSkip("SCCS");
+    }
+
+    /**
+     * Can't check in "CVS" or "SCCS" directories,
+     * so construct for each test.
+     */
+    private void doTestSkip(String name) {
+        File dir = new File(sourceroot, name);
+        sourceroot.mkdirs();
+        File file = new File(dir, "Error.java");
+        FileUtil.writeAsString(file, "public class Error { here }");
+        file = new File(sourceroot, "Main.java");
+        FileUtil.writeAsString(file, MAIN);
+        String[] args = { "-sourceroots", sourceroot.getPath() };
+        CompilationResult result = ajc(baseDir, args);
+        assertNoMessages(result);
+        RunResult r = run("Main"); 
+        String m = r.getStdOut().trim();
+        assertEquals("I ran", m);
+    }
+    private static final String MAIN =
+        "public class Main { public static void main(String[] a) {System.out.println(\"I ran\");}}";
+}