diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build')
3 files changed, 19 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java index aca42726d5..3fd15f8a28 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java @@ -13,7 +13,6 @@ // limitations under the License. package com.google.devtools.build.lib.analysis.mock; -import com.google.common.base.Functions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider; @@ -30,6 +29,7 @@ import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.rules.apple.swift.SwiftConfiguration; import com.google.devtools.build.lib.rules.config.ConfigFeatureFlagConfiguration; import com.google.devtools.build.lib.rules.cpp.CppConfigurationLoader; +import com.google.devtools.build.lib.rules.cpp.CpuTransformer; import com.google.devtools.build.lib.rules.java.JavaConfigurationLoader; import com.google.devtools.build.lib.rules.java.JvmConfigurationLoader; import com.google.devtools.build.lib.rules.objc.J2ObjcConfiguration; @@ -275,7 +275,7 @@ public final class BazelAnalysisMock extends AnalysisMock { public List<ConfigurationFragmentFactory> getDefaultConfigurationFragmentFactories() { return ImmutableList.<ConfigurationFragmentFactory>of( new BazelConfiguration.Loader(), - new CppConfigurationLoader(Functions.<String>identity()), + new CppConfigurationLoader(CpuTransformer.IDENTITY), new PythonConfigurationLoader(), new BazelPythonConfiguration.Loader(), new JvmConfigurationLoader(), diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java index 1cc7282f44..cfd41e7dc6 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java @@ -17,7 +17,6 @@ package com.google.devtools.build.lib.rules.cpp; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; -import com.google.common.base.Functions; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -62,7 +61,7 @@ public class CrosstoolConfigurationLoaderTest extends AnalysisTestCase { private CppConfigurationLoader loader(String crosstoolFileContents) throws IOException { getAnalysisMock().ccSupport().setupCrosstoolWithRelease(mockToolsConfig, crosstoolFileContents); - return new CppConfigurationLoader(Functions.<String>identity()); + return new CppConfigurationLoader(CpuTransformer.IDENTITY); } @Before diff --git a/src/test/java/com/google/devtools/build/lib/vfs/PathTest.java b/src/test/java/com/google/devtools/build/lib/vfs/PathTest.java index 8a1e14fbcf..eaad458438 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/PathTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/PathTest.java @@ -16,10 +16,14 @@ package com.google.devtools.build.lib.vfs; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.testing.EqualsTester; import com.google.common.testing.GcFinalization; import com.google.devtools.build.lib.clock.BlazeClock; +import com.google.devtools.build.lib.skyframe.serialization.InjectingObjectCodecAdapter; +import com.google.devtools.build.lib.skyframe.serialization.testutils.FsUtils; +import com.google.devtools.build.lib.skyframe.serialization.testutils.ObjectCodecTester; import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -309,6 +313,18 @@ public class PathTest { assertThat(uri.toString()).isEqualTo("file:///tmp/foo%20bar.txt"); } + @Test + public void testCodec() throws Exception { + ObjectCodecTester.newBuilder( + new InjectingObjectCodecAdapter<>(Path.CODEC, FsUtils.TEST_FILESYSTEM_PROVIDER)) + .addSubjects( + ImmutableList.of( + FsUtils.TEST_FILESYSTEM.getPath("/"), + FsUtils.TEST_FILESYSTEM.getPath("/some/path"), + FsUtils.TEST_FILESYSTEM.getPath("/some/other/path/with/empty/last/fragment/"))) + .buildAndRunTests(); + } + private void assertAsFragmentWorks(String expected) { assertThat(filesystem.getPath(expected).asFragment()).isEqualTo(PathFragment.create(expected)); } |