aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-12-19 12:25:43 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-19 12:27:53 -0800
commit2258b811e451451b8716d1267c228b7f59e1e56d (patch)
treece30fd309ce9ba6e3737c4ad8ca268dbf46a777a /src/test
parent16f1c19c2c4f68555bb23891e3a4da4d5ac4a68d (diff)
Makes PathFragment have internal CODEC definition.
PiperOrigin-RevId: 179588512
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/serialization/PathFragmentCodecTest.java30
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java13
2 files changed, 13 insertions, 30 deletions
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<PathFragment> {
-
- 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;
@@ -550,6 +552,17 @@ public class PathFragmentTest {
}
@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);
}