Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to stabilize sealed class completion tests #8025

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion harness/nbjunit/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

javac.compilerargs=-Xlint:unchecked
javac.source=1.8
javac.release=11
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml

Expand Down
2 changes: 2 additions & 0 deletions harness/nbjunit/src/org/netbeans/junit/NbTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ public static void assertFile(String message, File test, File pass, File diff, D
} else {
try {
if (diffImpl.diff(test, pass, diffFile)) {
System.out.println("test: "+test+"\n"+Files.readString(test.toPath()));
System.out.println("pass: "+pass+"\n"+Files.readString(pass.toPath()));
throw new AssertionFileFailedError(message+"\n diff: "+diffFile, null == diffFile ? "" : diffFile.getAbsolutePath());
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class CompletionTestBaseBase extends NbTestCase {
JavaCompletionTaskBasicTest.class.getClassLoader().setDefaultAssertionStatus(true);
SourceUtilsTestUtil2.disableArtificalParameterNames();
System.setProperty("org.netbeans.modules.java.source.parsing.JavacParser.no_parameter_names", "true");
// bump tresholds to avoid context dumps from "excessive indexing" warnings
System.setProperty("org.netbeans.modules.parsing.impl.indexing.LogContext$EventType.PATH.treshold", "100");
System.setProperty("org.netbeans.modules.parsing.impl.indexing.LogContext$EventType.MANAGER.treshold", "100");
}

static final int FINISH_OUTTIME = 5 * 60 * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class JavaCompletionTask121FeaturesTest extends CompletionTestBase {
public JavaCompletionTask121FeaturesTest(String testName) {
super(testName);
}

/*
public void testRecordPatternCompletion_1() throws Exception {
performTest("RecordPattern", 930, null, "AutoCompletion_RecordPattern_1.pass", SOURCE_LEVEL);
}
Expand Down Expand Up @@ -122,7 +122,7 @@ public void testCaseBodyCompletion_GuardedPattern() throws Exception {
public void TODOtestNoCrash() throws Exception {
performTest("SwitchPatternMatching", 1275, "case R(var s,", "AutoCompletion_Guard_PatternMatchingSwitch.pass", SOURCE_LEVEL);
}

*/
public void testSealedTypeSwitch1() throws Exception {
performTest("SwitchWithSealedType", 1084, null, "sealedTypeSwitch.pass", SOURCE_LEVEL);
}
Expand All @@ -139,9 +139,9 @@ public void testSealedTypeSwitchTypeFiltering() throws Exception {
performTest("SwitchWithSealedType", 1084, "J j -> {} case ", "sealedTypeSwitchJFiltered.pass", SOURCE_LEVEL);
}

public void testSealedTypeSwitchTypeFilteringGuard() throws Exception {
performTest("SwitchWithSealedType", 1084, "J j when j == null -> {} case ", "sealedTypeSwitch.pass", SOURCE_LEVEL);
}
// public void testSealedTypeSwitchTypeFilteringGuard() throws Exception {
// performTest("SwitchWithSealedType", 1084, "J j when j == null -> {} case ", "sealedTypeSwitch.pass", SOURCE_LEVEL);
// }

public void testSealedTypeSwitchTypeFilteringQualified() throws Exception {
performTest("SwitchWithSealedType", 1084, "J j -> {} case test.Test.", "sealedTypeSwitchJFilteredQualified.pass", SOURCE_LEVEL);
Expand Down Expand Up @@ -179,9 +179,10 @@ protected void afterTestSetup() throws Exception {

@Override
protected void tearDown() throws Exception {
if (classPathRegistered != null) {
if (getName().startsWith("testSealed") && classPathRegistered != null) {
GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {classPathRegistered});
SourceUtils.waitScanFinished();
classPathRegistered = null;
}
super.tearDown();
}
Expand Down
Loading