Search in sources :

Example 26 with InMemoryFileSystem

use of com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem in project bazel by bazelbuild.

the class PathFragmentTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    InMemoryFileSystem filesystem = new InMemoryFileSystem();
    new EqualsTester().addEqualityGroup(new PathFragment("../relative/path"), new PathFragment("..").getRelative("relative").getRelative("path"), new PathFragment('\0', false, new String[] { "..", "relative", "path" }), new PathFragment(new File("../relative/path"))).addEqualityGroup(new PathFragment("something/else")).addEqualityGroup(new PathFragment("/something/else")).addEqualityGroup(new PathFragment("/"), new PathFragment("//////")).addEqualityGroup(new PathFragment(""), PathFragment.EMPTY_FRAGMENT).addEqualityGroup(// A Path object.
    filesystem.getRootDirectory()).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) InMemoryFileSystem(com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem) File(java.io.File) Test(org.junit.Test)

Aggregations

InMemoryFileSystem (com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem)26 Path (com.google.devtools.build.lib.vfs.Path)14 Before (org.junit.Before)14 FileSystem (com.google.devtools.build.lib.vfs.FileSystem)8 Test (org.junit.Test)8 IOException (java.io.IOException)7 TestAction (com.google.devtools.build.lib.actions.util.TestAction)3 ManualClock (com.google.devtools.build.lib.testutil.ManualClock)3 HashFunction (com.google.devtools.build.lib.vfs.FileSystem.HashFunction)3 FileNotFoundException (java.io.FileNotFoundException)3 EqualsTester (com.google.common.testing.EqualsTester)2 Dirent (com.google.devtools.build.lib.vfs.Dirent)2 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)2 File (java.io.File)2 Artifact (com.google.devtools.build.lib.actions.Artifact)1 BuildFailedException (com.google.devtools.build.lib.actions.BuildFailedException)1 BlazeDirectories (com.google.devtools.build.lib.analysis.BlazeDirectories)1 Scratch (com.google.devtools.build.lib.testutil.Scratch)1 TestThread (com.google.devtools.build.lib.testutil.TestThread)1 FileStatus (com.google.devtools.build.lib.vfs.FileStatus)1