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.

Ajc165Tests.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*******************************************************************************
  2. * Copyright (c) 2008 Contributors
  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. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc165;
  12. import java.util.List;
  13. import org.aspectj.bridge.IMessage;
  14. import org.aspectj.testing.XMLBasedAjcTestCase;
  15. import org.aspectj.weaver.LintMessage;
  16. import junit.framework.Test;
  17. public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
  18. // fix is too disruptive for 1.6.5
  19. // public void testGenericsBridge_pr279983() {
  20. // runTest("generics bridge");
  21. // }
  22. public void testVerifyError_pr277959() {
  23. runTest("verifyerror");
  24. }
  25. // on the build machine (linux) - these tests don't expect the right output - i suspect due to CR/LF issues
  26. // since that will affect the generated name of the if methods
  27. // public void testIfNames_pr277508() {
  28. // runTest("if method names");
  29. // }
  30. //
  31. // public void testIfNames_pr277508_2() {
  32. // runTest("if method names - 2");
  33. // }
  34. public void testDecAnnoMethod_pr275625() {
  35. runTest("dec anno method");
  36. }
  37. public void testDecAnnoField_pr275625() {
  38. runTest("dec anno field");
  39. }
  40. // check ITD can replace a generated default constructor
  41. public void testItdDefaultCtor_pr275032() {
  42. runTest("itd default ctor");
  43. }
  44. // check ITD can't overwrite an existing constructor
  45. public void testItdDefaultCtor_pr275032_2() {
  46. runTest("itd default ctor - 2");
  47. }
  48. // binary weaving version of case 2 - check ITD can't overwrite an existing constructor
  49. public void testItdDefaultCtor_pr275032_3() {
  50. runTest("itd default ctor - 3");
  51. }
  52. // binary weaving version of case 4 - check ITD can replace a generated default constructor
  53. public void testItdDefaultCtor_pr275032_4() {
  54. runTest("itd default ctor - 4");
  55. }
  56. public void testVerifyOnAnnoBind_pr273628() {
  57. runTest("verifyerror on anno bind");
  58. }
  59. public void testFunkyPointcut_pr272233() {
  60. runTest("funky pointcut");
  61. }
  62. public void testFunkyPointcut_pr272233_2() {
  63. runTest("funky pointcut 2");
  64. }
  65. public void testAnnotationStyle_pr265356() {
  66. runTest("annotation style message positions");
  67. List<IMessage> ms = ajc.getLastCompilationResult().getWarningMessages();
  68. boolean checked = true;
  69. // Look for the message relating to 'List' and check the offsets
  70. for (IMessage iMessage : ms) {
  71. LintMessage m = (LintMessage) iMessage;
  72. if (m.toString().contains("List")) {
  73. // 225/228 on windows - 237/240 on linux
  74. if (!(m.getSourceStart() == 225 || m.getSourceStart() == 237)) {
  75. fail("Did not get expected start position, was:" + m.getSourceStart());
  76. }
  77. if (!(m.getSourceEnd() == 228 || m.getSourceEnd() == 240)) {
  78. fail("Did not get expected end position, was:" + m.getSourceEnd());
  79. }
  80. checked = true;
  81. }
  82. }
  83. assertTrue("Failed to check the message", checked);
  84. }
  85. public void testAroundCall_pr271169() {
  86. runTest("around call npe");
  87. }
  88. public void testGenericITD_pr272825() {
  89. runTest("generic ITD");
  90. }
  91. // ---
  92. public static Test suite() {
  93. return XMLBasedAjcTestCase.loadSuite(Ajc165Tests.class);
  94. }
  95. @Override
  96. protected java.net.URL getSpecFile() {
  97. return getClassResource("ajc165.xml");
  98. }
  99. }