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.

Java19PreviewFeaturesTests.java 4.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.ajc1919;
  9. import junit.framework.Test;
  10. import org.aspectj.apache.bcel.Constants;
  11. import org.aspectj.testing.XMLBasedAjcTestCase;
  12. import org.aspectj.testing.XMLBasedAjcTestCaseForJava19Only;
  13. /**
  14. * @author Alexander Kriegisch
  15. */
  16. public class Java19PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava19Only {
  17. public void testSwitchPatternMatchingPreview3Java() {
  18. runTest("switch pattern matching preview 3 java");
  19. checkVersion("SwitchPatternPreview3OK", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
  20. }
  21. public void testSwitchPatternMatchingPreview3Aspect() {
  22. runTest("switch pattern matching preview 3 aspect");
  23. checkVersion("SwitchPatternPreview3Aspect", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
  24. checkVersion("Application", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
  25. checkVersion("Shape", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
  26. checkVersion("S", Constants.MAJOR_19, Constants.PREVIEW_MINOR_VERSION);
  27. }
  28. public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() {
  29. runTest("switch pattern matching error");
  30. }
  31. public void testSwitchPatternMatchingPreview3Error1() {
  32. runTest("switch pattern matching preview 3 error 1");
  33. }
  34. public void testSwitchPatternMatchingPreview3Error2() {
  35. runTest("switch pattern matching preview 3 error 2");
  36. }
  37. public void testRecordPatternsPreview1OK() {
  38. // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450
  39. runTest("record patterns");
  40. }
  41. public void testRecordPatternsPreview1Error() {
  42. // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/450
  43. runTest("record patterns error");
  44. }
  45. public void testRecordPatternsPreview1ExhaustivenessOK1() {
  46. // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected' twice,
  47. // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455
  48. // TODO: activate when fixed
  49. System.out.println("TODO: activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed");
  50. //runTest("record patterns exhaustiveness 1");
  51. }
  52. public void testRecordPatternsPreview1Aspect() {
  53. runTest("record patterns aspect");
  54. }
  55. public void testRecordPatternsPreview1ExhaustivenessAspect() {
  56. // TODO: Remove redundant default clauses in RecordPatternsPreview1Aspect when
  57. // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed. Furthermore, activate '<run />'
  58. // action for XML test case in order to not just compile but also run the code.
  59. System.out.println("TODO: fully activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455 has been fixed");
  60. runTest("record patterns exhaustiveness aspect");
  61. }
  62. public void testRecordPatternsPreview1ExhaustivenessError() {
  63. // See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455
  64. runTest("record patterns exhaustiveness error");
  65. }
  66. public void testRecordPatternsPreview1ExhaustivenessOK2() {
  67. // Falsely throws 'An enhanced switch statement should be exhaustive; a default label expected',
  68. // see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398
  69. // TODO: activate when fixed
  70. System.out.println("TODO: activate when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/398 has been fixed");
  71. //runTest("record patterns exhaustiveness 2");
  72. }
  73. public static Test suite() {
  74. return XMLBasedAjcTestCase.loadSuite(Java19PreviewFeaturesTests.class);
  75. }
  76. @Override
  77. protected java.net.URL getSpecFile() {
  78. return getClassResource("ajc1919.xml");
  79. }
  80. }