Skip to content

Commit

Permalink
polish tests
Browse files Browse the repository at this point in the history
+ simplify option handling
+ align javac option in test with disabled preview
+ restore api-filter for SourceRange lost in commit 656af06
  • Loading branch information
stephan-herrmann committed Jul 13, 2024
1 parent 8b5b645 commit 27ccd13
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected void runNegativeTest(String[] testFiles, String expectedCompilerLog) {
class Runner extends AbstractRegressionTest.Runner {
public Runner(boolean reportPreview) {
this();
this.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
this.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, reportPreview ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
}
public Runner() {
super();
Expand Down Expand Up @@ -1506,10 +1506,7 @@ public X(int value) {
options);
}
public void testGH2467() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test3.java",
"""
Expand All @@ -1535,10 +1532,7 @@ Cannot invoke method foo() in an early construction context
runner.runNegativeTest();
}
public void testOuterConstruction_1() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test.java",
"""
Expand Down Expand Up @@ -1571,10 +1565,7 @@ Cannot invoke method foo() in an early construction context
}

public void testOuterConstruction_2() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test.java",
"""
Expand All @@ -1599,10 +1590,7 @@ public static void main(String... args) {
runner.runConformTest();
}
public void testFieldAssignedInSuperArgument_OK() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test.java",
"""
Expand Down Expand Up @@ -1641,6 +1629,7 @@ public void testFieldAssignedInSuperArgument_notEnabled() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
runner.javacTestOptions = JavacTestOptions.DEFAULT;
runner.testFiles = new String[] {
"Test.java",
"""
Expand Down Expand Up @@ -1692,10 +1681,7 @@ public class Test extends Super {
runner.runNegativeTest();
}
public void testFieldCompoundAssignedInSuperArgument() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test.java",
"""
Expand Down Expand Up @@ -1747,10 +1733,7 @@ public class Test extends Super {
runner.runNegativeTest();
}
public void testFieldReadInSuperArgument() {
Runner runner = new Runner();
runner.customOptions = getCompilerOptions();
runner.customOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
runner.customOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
Runner runner = new Runner(false);
runner.testFiles = new String[] {
"Test.java",
"""
Expand Down
8 changes: 8 additions & 0 deletions org.eclipse.jdt.core/.settings/.api_filters
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/core/SourceRange.java" type="org.eclipse.jdt.core.SourceRange">
<filter id="576725006">
<message_arguments>
<message_argument value="ISourceRange"/>
<message_argument value="SourceRange"/>
</message_arguments>
</filter>
</resource>
<resource path="model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java" type="org.eclipse.jdt.core.compiler.ITerminalSymbols">
<filter id="405864542">
<message_arguments>
Expand Down

0 comments on commit 27ccd13

Please sign in to comment.