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.

SanityTestsJava18.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*******************************************************************************
  2. * Copyright (c) 2022 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.ajc199;
  9. import junit.framework.Test;
  10. import org.aspectj.testing.XMLBasedAjcTestCase;
  11. import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater;
  12. /*
  13. * Some very trivial tests that help verify things are OK.
  14. * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -18 option
  15. * to check code generation and modification with that version specified.
  16. *
  17. * @author Alexander Kriegisch
  18. */
  19. public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater {
  20. public static final int bytecode_version_for_JDK_level = 62;
  21. // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
  22. public void testSimpleJava_A() {
  23. runTest("simple - a");
  24. }
  25. public void testSimpleJava_B() {
  26. runTest("simple - b");
  27. }
  28. public void testSimpleCode_C() {
  29. runTest("simple - c");
  30. }
  31. public void testSimpleCode_D() {
  32. runTest("simple - d");
  33. }
  34. public void testSimpleCode_E() {
  35. runTest("simple - e");
  36. }
  37. public void testSimpleCode_F() {
  38. runTest("simple - f");
  39. }
  40. public void testSimpleCode_G() {
  41. runTest("simple - g");
  42. }
  43. public void testSimpleCode_H() {
  44. runTest("simple - h", true);
  45. }
  46. public void testSimpleCode_I() {
  47. runTest("simple - i");
  48. }
  49. public void testVersionCorrect1() {
  50. runTest("simple - j");
  51. checkVersion("A", bytecode_version_for_JDK_level, 0);
  52. }
  53. public void testVersionCorrect2() {
  54. runTest("simple - k");
  55. checkVersion("A", bytecode_version_for_JDK_level, 0);
  56. }
  57. public void testVersionCorrect4() {
  58. runTest("simple - m");
  59. // Must be 49.0 when -1.5 is specified
  60. checkVersion("A", 49, 0);
  61. }
  62. public static Test suite() {
  63. return XMLBasedAjcTestCase.loadSuite(SanityTestsJava18.class);
  64. }
  65. @Override
  66. protected java.net.URL getSpecFile() {
  67. return getClassResource("sanity-tests-18.xml");
  68. }
  69. }