mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[test framework] an attempt to better guess target path for files copied into test project (IDEA-223901)
GitOrigin-RevId: ed184e44e72b41c52d51b00d3a989dd72883b54e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
16786f4b89
commit
8620ee09b5
+9
-1
@@ -129,6 +129,8 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -347,7 +349,13 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
if (candidate.isAbsolute()) {
|
||||
sourceFile = candidate;
|
||||
if (targetPath == sourcePath) {
|
||||
targetPath = PathUtil.getFileName(sourcePath);
|
||||
Path testDataPathObj = Paths.get(testDataPath), targetPathObj = Paths.get(targetPath);
|
||||
if (targetPathObj.startsWith(testDataPathObj)) {
|
||||
targetPath = testDataPathObj.relativize(targetPathObj).toString();
|
||||
}
|
||||
else {
|
||||
targetPath = targetPathObj.getFileName().toString();
|
||||
}
|
||||
Logger.getInstance(getClass()).warn("Absolute target path '" + sourcePath + "' trimmed to '" + targetPath + "'");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user