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.

SanityTestsJava13.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*******************************************************************************
  2. * Copyright (c) 2006, 2018 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.ajc195;
  9. import org.aspectj.apache.bcel.Constants;
  10. import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
  11. import org.aspectj.testing.XMLBasedAjcTestCase;
  12. import junit.framework.Test;
  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 -13 option
  16. * to check code generation and modification with that version specified.
  17. *
  18. * @author Andy Clement
  19. */
  20. public class SanityTestsJava13 extends JavaVersionSpecificXMLBasedAjcTestCase {
  21. public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(13).MAJOR;
  22. public SanityTestsJava13() {
  23. super(13);
  24. }
  25. // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
  26. public void testSimpleJava_A() {
  27. runTest("simple - a");
  28. }
  29. public void testSimpleJava_B() {
  30. runTest("simple - b");
  31. }
  32. public void testSimpleCode_C() {
  33. runTest("simple - c");
  34. }
  35. public void testSimpleCode_D() {
  36. runTest("simple - d");
  37. }
  38. public void testSimpleCode_E() {
  39. runTest("simple - e");
  40. }
  41. public void testSimpleCode_F() {
  42. runTest("simple - f");
  43. }
  44. public void testSimpleCode_G() {
  45. runTest("simple - g");
  46. }
  47. public void testSimpleCode_H() {
  48. runTest("simple - h", true);
  49. }
  50. public void testSimpleCode_I() {
  51. runTest("simple - i");
  52. }
  53. public void testVersionCorrect1() throws ClassNotFoundException {
  54. runTest("simple - j");
  55. checkVersion("A", bytecode_version_for_JDK_level, 0);
  56. }
  57. public void testVersionCorrect2() throws ClassNotFoundException {
  58. runTest("simple - k");
  59. checkVersion("A", bytecode_version_for_JDK_level, 0);
  60. }
  61. public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified
  62. runTest("simple - m");
  63. checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0);
  64. }
  65. // ///////////////////////////////////////
  66. public static Test suite() {
  67. return XMLBasedAjcTestCase.loadSuite(SanityTestsJava13.class);
  68. }
  69. @Override
  70. protected java.net.URL getSpecFile() {
  71. return getClassResource("sanity-tests-13.xml");
  72. }
  73. }