You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SCCSFixTests.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*******************************************************************************
  2. * Copyright (c) 2005 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Wes Isberg - initial implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc150;
  12. import java.io.File;
  13. import org.aspectj.tools.ajc.AjcTestCase;
  14. import org.aspectj.tools.ajc.CompilationResult;
  15. import org.aspectj.util.FileUtil;
  16. /**
  17. * SCCS/CVS directory fix.
  18. * Would add to Ajc150TestsNoHarness, but can't share basedir/setup, etc.
  19. */
  20. public class SCCSFixTests extends AjcTestCase {
  21. File baseDir;
  22. File sourceroot;
  23. public void setUp() throws Exception {
  24. super.setUp();
  25. baseDir = FileUtil.getTempDir("BugFixTests");
  26. sourceroot = new File(baseDir, "sourceroot");
  27. sourceroot.mkdirs();
  28. }
  29. public void tearDown() {
  30. FileUtil.deleteContents(baseDir);
  31. }
  32. /**
  33. * @see org/aspectj/util/FileUtil.java 1.17
  34. * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650
  35. */
  36. public void testSkipCVS() {
  37. doTestSkip("CVS");
  38. }
  39. /**
  40. * @see org/aspectj/util/FileUtil.java 1.17
  41. * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650
  42. */
  43. public void testSkipSCCS() {
  44. doTestSkip("SCCS");
  45. }
  46. /**
  47. * Can't check in "CVS" or "SCCS" directories,
  48. * so construct for each test.
  49. */
  50. private void doTestSkip(String name) {
  51. File dir = new File(sourceroot, name);
  52. sourceroot.mkdirs();
  53. File file = new File(dir, "Error.java");
  54. FileUtil.writeAsString(file, "public class Error { here }");
  55. file = new File(sourceroot, "Main.java");
  56. FileUtil.writeAsString(file, MAIN);
  57. String[] args = { "-sourceroots", sourceroot.getPath() };
  58. CompilationResult result = ajc(baseDir, args);
  59. assertNoMessages(result);
  60. RunResult r = run("Main");
  61. String m = r.getStdOut().trim();
  62. assertEquals("I ran", m);
  63. }
  64. private static final String MAIN =
  65. "public class Main { public static void main(String[] a) {System.out.println(\"I ran\");}}";
  66. }