aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java
blob: ea53ae6a61ea6a2ca097cc4bbbede219dcf1f3d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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 Eclipse Public License v 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 *
 * 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\");}}";
}