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.

SanityTestsJava21.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*******************************************************************************
  2. * Copyright (c) 2023 Contributors
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *******************************************************************************/
  8. package org.aspectj.systemtest.ajc1921;
  9. import junit.framework.Test;
  10. import org.aspectj.apache.bcel.Constants;
  11. import org.aspectj.testing.XMLBasedAjcTestCase;
  12. import org.aspectj.testing.XMLBasedAjcTestCaseForJava21OrLater;
  13. /*
  14. * Some very trivial tests that help verify things are OK.
  15. * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -21 option
  16. * to check code generation and modification with that version specified.
  17. *
  18. * @author Alexander Kriegisch
  19. */
  20. public class SanityTestsJava21 extends XMLBasedAjcTestCaseForJava21OrLater {
  21. public static final int bytecode_version_for_JDK_level = Constants.MAJOR_21;
  22. // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
  23. public void testSimpleJava_A() {
  24. runTest("simple - a");
  25. }
  26. public void testSimpleJava_B() {
  27. runTest("simple - b");
  28. }
  29. public void testSimpleCode_C() {
  30. runTest("simple - c");
  31. }
  32. public void testSimpleCode_D() {
  33. runTest("simple - d");
  34. }
  35. public void testSimpleCode_E() {
  36. runTest("simple - e");
  37. }
  38. public void testSimpleCode_F() {
  39. runTest("simple - f");
  40. }
  41. public void testSimpleCode_G() {
  42. runTest("simple - g");
  43. }
  44. public void testSimpleCode_H() {
  45. runTest("simple - h", true);
  46. }
  47. public void testSimpleCode_I() {
  48. runTest("simple - i");
  49. }
  50. public void testVersionCorrect1() {
  51. runTest("simple - j");
  52. checkVersion("A", bytecode_version_for_JDK_level, 0);
  53. }
  54. public void testVersionCorrect2() {
  55. runTest("simple - k");
  56. checkVersion("A", bytecode_version_for_JDK_level, 0);
  57. }
  58. public void testVersionCorrect4() {
  59. runTest("simple - m");
  60. // Must be 49.0 when -1.5 is specified
  61. checkVersion("A", Constants.MAJOR_1_5, 0);
  62. }
  63. public static Test suite() {
  64. return XMLBasedAjcTestCase.loadSuite(SanityTestsJava21.class);
  65. }
  66. @Override
  67. protected java.net.URL getSpecFile() {
  68. return getClassResource("sanity-tests-21.xml");
  69. }
  70. }