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.

SymbolFileGenerationTest.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/epl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.ajde;
  14. import java.io.File;
  15. import java.io.FileFilter;
  16. import org.aspectj.tools.ajc.AjcTestCase;
  17. import org.aspectj.util.FileUtil;
  18. /**
  19. * @author Mik Kersten
  20. */
  21. public class SymbolFileGenerationTest extends AjcTestCase {
  22. private static final String DIR = "../ajde/testdata/examples/coverage";
  23. protected File dir = new File(DIR);
  24. protected File configFile = new File(DIR + "/coverage.lst");
  25. protected File esymFile, outDir, crossRefsFile;
  26. protected void setUp() throws Exception {
  27. super.setUp();
  28. esymFile = new File(DIR + "/ModelCoverage.ajesym");
  29. outDir = new File(DIR + "/bin");
  30. crossRefsFile = new File(outDir.getAbsolutePath() + "/build.ajsym");
  31. }
  32. protected void tearDown() throws Exception {
  33. super.tearDown();
  34. FileUtil.deleteContents(new File(DIR), ajesymResourceFileFilter);
  35. FileUtil.deleteContents(new File(DIR + "/pkg"), ajesymResourceFileFilter);
  36. FileUtil.deleteContents(new File(DIR + "/bin"));
  37. (new File(DIR + "/bin")).delete();
  38. }
  39. public FileFilter ajesymResourceFileFilter = new FileFilter() {
  40. public boolean accept(File pathname) {
  41. String name = pathname.getName().toLowerCase();
  42. return name.endsWith(".ajesym");
  43. }
  44. };
  45. public void testCrossRefsFileGeneration() {
  46. if (crossRefsFile.exists())
  47. assertTrue(crossRefsFile.delete());
  48. if (esymFile.exists())
  49. assertTrue(esymFile.delete());
  50. String[] args = new String[] { "-d", outDir.getAbsolutePath(), "-crossrefs", "@" + configFile.getAbsolutePath() };
  51. ajc(dir, args);
  52. assertFalse(esymFile.exists());
  53. assertTrue(crossRefsFile.exists());
  54. }
  55. public void testEmacssymGeneration() {
  56. if (crossRefsFile.exists()) {
  57. assertTrue(crossRefsFile.delete());
  58. }
  59. if (esymFile.exists())
  60. assertTrue(esymFile.delete());
  61. String[] args = new String[] { "-d", outDir.getAbsolutePath(), "-emacssym", "@" + configFile.getAbsolutePath() };
  62. ajc(dir, args);
  63. assertTrue(esymFile.exists());
  64. assertFalse(crossRefsFile.exists());
  65. }
  66. }