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.

SanityTestsJava10.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*******************************************************************************
  2. * Copyright (c) 2006, 2081 IBM and 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.ajc191;
  9. import org.aspectj.apache.bcel.Constants;
  10. import org.aspectj.testing.XMLBasedAjcTestCase;
  11. import junit.framework.Test;
  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 -10 option
  15. * to check code generation and modification with that version specified.
  16. *
  17. * @author Andy Clement
  18. */
  19. public class SanityTestsJava10 extends XMLBasedAjcTestCase {
  20. public static final int bytecode_version_for_JDK_level = Constants.ClassFileVersion.of(10).MAJOR;
  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() throws ClassNotFoundException {
  50. runTest("simple - j");
  51. checkVersion("A", bytecode_version_for_JDK_level, 0);
  52. }
  53. public void testVersionCorrect2() throws ClassNotFoundException {
  54. runTest("simple - k");
  55. checkVersion("A", bytecode_version_for_JDK_level, 0);
  56. }
  57. public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified
  58. runTest("simple - m");
  59. checkVersion("A", Constants.ClassFileVersion.of(5).MAJOR, 0);
  60. }
  61. public static Test suite() {
  62. return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class);
  63. }
  64. @Override
  65. protected java.net.URL getSpecFile() {
  66. return getClassResource("sanity-tests-10.xml");
  67. }
  68. }