From b950b452233246e72bccea74959d0a1ef094d6c9 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 28 Jul 2017 20:27:24 +0200 Subject: [PATCH] mad testing: canonicalize paths, delete non-suitable files, export jetCheck dependency --- java/java-tests/java-tests.iml | 1 - platform/testFramework/testFramework.iml | 2 +- .../testFramework/propertyBased/MadTestingUtil.java | 11 ++++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/java/java-tests/java-tests.iml b/java/java-tests/java-tests.iml index 42db66095fac..47ccdb4f49db 100644 --- a/java/java-tests/java-tests.iml +++ b/java/java-tests/java-tests.iml @@ -57,6 +57,5 @@ - \ No newline at end of file diff --git a/platform/testFramework/testFramework.iml b/platform/testFramework/testFramework.iml index 8579617f8501..0a76638cb42a 100644 --- a/platform/testFramework/testFramework.iml +++ b/platform/testFramework/testFramework.iml @@ -26,6 +26,6 @@ - + \ No newline at end of file diff --git a/platform/testFramework/testSrc/com/intellij/testFramework/propertyBased/MadTestingUtil.java b/platform/testFramework/testSrc/com/intellij/testFramework/propertyBased/MadTestingUtil.java index fa8d94c75d9d..1ec35942ea64 100644 --- a/platform/testFramework/testSrc/com/intellij/testFramework/propertyBased/MadTestingUtil.java +++ b/platform/testFramework/testSrc/com/intellij/testFramework/propertyBased/MadTestingUtil.java @@ -155,7 +155,7 @@ public class MadTestingUtil { } /** - * Finds files under {@code rootPath} (e.g. test data root) satisfying {@code fileFilter condition} (e.g. correct extension) and uses {@code actions} to generate actions those files (e.g. invoke compleiton/intentions or random editing). + * Finds files under {@code rootPath} (e.g. test data root) satisfying {@code fileFilter condition} (e.g. correct extension) and uses {@code actions} to generate actions those files (e.g. invoke completion/intentions or random editing). * Almost: the files with same paths and contents are created inside the test project, then the actions are executed on them. * Note that the test project contains only one file at each moment, so it's best to test actions that don't require much environment. * @return @@ -182,10 +182,12 @@ public class MadTestingUtil { PsiDocumentManager.getInstance(fixture.getProject()).commitAllDocuments(); PsiFile file = PsiManager.getInstance(fixture.getProject()).findFile(vFile); if (file instanceof PsiBinaryFile || file instanceof PsiPlainTextFile) { - return Generator.constant(null); + // no operations, but the just created file needs to be deleted (in FileWithActions#runActions) + // todo a side-effect-free generator + return Generator.constant(new FileWithActions(file, Collections.emptyList())); } return Generator.nonEmptyLists(actions.apply(file)).map(a -> new FileWithActions(file, a)); - }).suchThat(Objects::nonNull); + }); } private static boolean shouldGoInsiderDir(@NotNull String name) { @@ -206,9 +208,8 @@ public class MadTestingUtil { @NotNull private static VirtualFile copyFileToProject(File ioFile, CodeInsightTestFixture fixture, String rootPath) { - //todo strip test data markup try { - String path = FileUtil.getRelativePath(rootPath, ioFile.getPath(), '/'); + String path = FileUtil.getRelativePath(FileUtil.toCanonicalPath(rootPath), ioFile.getPath(), '/'); assert path != null; VirtualFile existing = fixture.findFileInTempDir(path); if (existing != null) {