fix test under Linux when findChild(name with backslashes) was returning null but shouldn't have (IDEA-CR-56333)

GitOrigin-RevId: c3d94e461bf5b30146e19510a8f3e57d1a0a127f
This commit is contained in:
Alexey Kudravtsev
2019-12-10 11:35:06 +00:00
committed by intellij-monorepo-bot
parent 3a4e0a00ff
commit 0e8ed9ab0c
2 changed files with 2 additions and 14 deletions
@@ -36,6 +36,7 @@ import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -216,7 +217,7 @@ public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
}
private static boolean isFileSeparator(char c) {
return c == '/' || c=='\\';
return c == '/' || c == File.separatorChar;
}
@NotNull
@@ -19,7 +19,6 @@ import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
import com.intellij.testFramework.rules.TempDirectory;
@@ -33,7 +32,6 @@ import java.io.*;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
@@ -41,7 +39,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.jar.JarFile;
import java.util.zip.ZipFile;
import static com.intellij.openapi.util.io.IoTestUtil.assertTimestampsEqual;
import static com.intellij.testFramework.PlatformTestUtil.assertPathsEqual;
@@ -258,16 +255,6 @@ public class JarFileSystemTest extends BareTestFixtureTestCase {
else {
assertNull(JarFileSystem.getInstance().findFileByPath(jarPath + JarFileSystem.JAR_SEPARATOR + crazyDir.replace('\\', '/') + crazyEntry));
VirtualFile dir = jarRoot.findChild(crazyDir);
LOG.debug(jarRoot + " children: " + Arrays.toString(jarRoot.getChildren()));
LOG.debug(" exist child: " + ContainerUtil.exists(jarRoot.getChildren(), c->c.getName().equals(crazyDir)));
LOG.debug(" persist children: " + Arrays.toString(PersistentFS.getInstance().listAll(jarRoot)));
try (ZipFile file = new ZipFile(jarPath)) {
LOG.debug("Entries: " + ContainerUtil.toList(file.entries()));
}
catch (IOException e) {
throw new RuntimeException(e);
}
assertNotNull(dir);
assertNotNull(dir.findChild(crazyEntry));
}