From a9c0153bf70367bdfb7712dca61f45ffe767d64f Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Thu, 27 Oct 2022 11:18:51 -0400 Subject: [PATCH] Better test error messages when workspace is not empty after test On GHA the error does not really give a good indication of what went wrong with minimal to no stack traces Part of #117 --- .../org/eclipse/cdt/core/testplugin/util/BaseTestCase5.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase5.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase5.java index 2cd4278fc83..23bf765250e 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase5.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase5.java @@ -156,7 +156,8 @@ public abstract class BaseTestCase5 { public static void assertWorkspaceIsEmpty() throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // use lists because error messages are nicer - assertEquals(List.of(), Arrays.asList(root.members())); + assertEquals(List.of(), Arrays.asList(root.members()), + "Found projects in workspace. This test or an earlier test did not clean up after itself."); File workspaceFile = root.getLocation().toFile(); @@ -169,7 +170,8 @@ public abstract class BaseTestCase5 { assertEquals(List.of(), Arrays.asList(file.list())); permitted.add("tmp"); } - assertEquals(List.of(), Arrays.asList(workspaceFile.list((dir, name) -> !permitted.contains(name)))); + assertEquals(List.of(), Arrays.asList(workspaceFile.list((dir, name) -> !permitted.contains(name))), + "Found files in workspace directory. This test or an earlier test did not clean up after itself."); } protected void deleteOnTearDown(File file) {