From 2258b811e451451b8716d1267c228b7f59e1e56d Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 19 Dec 2017 12:25:43 -0800 Subject: Makes PathFragment have internal CODEC definition. PiperOrigin-RevId: 179588512 --- .../serialization/PathFragmentCodecTest.java | 30 ---------------------- .../devtools/build/lib/vfs/PathFragmentTest.java | 13 ++++++++++ 2 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 src/test/java/com/google/devtools/build/lib/skyframe/serialization/PathFragmentCodecTest.java (limited to 'src/test') diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/PathFragmentCodecTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/serialization/PathFragmentCodecTest.java deleted file mode 100644 index 52490c719a..0000000000 --- a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/PathFragmentCodecTest.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.skyframe.serialization; - -import com.google.devtools.build.lib.skyframe.serialization.testutils.AbstractObjectCodecTest; -import com.google.devtools.build.lib.vfs.PathFragment; -import com.google.devtools.build.lib.vfs.PathFragmentCodec; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Basic tests for {@link PathFragmentCodec}. */ -@RunWith(JUnit4.class) -public class PathFragmentCodecTest extends AbstractObjectCodecTest { - - public PathFragmentCodecTest() { - super(new PathFragmentCodec(), PathFragment.create("/a/path/fragment/with/lots/of/parts")); - } -} diff --git a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java index bce569f887..41954851be 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.vfs; +import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; @@ -20,6 +21,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.testing.EqualsTester; +import com.google.devtools.build.lib.skyframe.serialization.testutils.ObjectCodecTester; import com.google.devtools.build.lib.testutil.TestUtils; import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem; import java.io.File; @@ -549,6 +551,17 @@ public class PathFragmentTest { assertThat(PathFragment.create("/..").normalize()).isEqualTo(PathFragment.create("/..")); } + @Test + public void testCodec() throws Exception { + ObjectCodecTester.newBuilder(PathFragment.CODEC) + .addSubjects( + ImmutableList.of("", "a", "/foo", "foo/bar/baz", "/a/path/fragment/with/lots/of/parts") + .stream() + .map(PathFragment::create) + .collect(toImmutableList())) + .buildAndRunTests(); + } + @Test public void testSerializationSimple() throws Exception { checkSerialization("a", 91); -- cgit v1.2.3