diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java index 17aecaf70b..2e43b80315 100644 --- a/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java +++ b/src/test/java/com/google/devtools/build/lib/cmdline/PackageIdentifierTest.java @@ -17,9 +17,7 @@ package com.google.devtools.build.lib.cmdline; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; -import com.google.devtools.build.lib.cmdline.PackageIdentifier.RepositoryName; import com.google.devtools.build.lib.vfs.PathFragment; import org.junit.Test; @@ -54,34 +52,6 @@ public class PackageIdentifierTest { assertThat(mainA.getRepository()).isEqualTo(PackageIdentifier.MAIN_REPOSITORY_NAME); } - public void assertNotValid(String name, String expectedMessage) { - try { - RepositoryName.create(name); - fail(); - } catch (LabelSyntaxException expected) { - assertThat(expected.getMessage()).contains(expectedMessage); - } - } - - @Test - public void testValidateRepositoryName() throws Exception { - assertEquals("@foo", RepositoryName.create("@foo").toString()); - assertThat(RepositoryName.create("").toString()).isEmpty(); - assertEquals("@foo_bar", RepositoryName.create("@foo_bar").toString()); - assertEquals("@foo-bar", RepositoryName.create("@foo-bar").toString()); - assertEquals("@foo.bar", RepositoryName.create("@foo.bar").toString()); - assertEquals("@..foo", RepositoryName.create("@..foo").toString()); - assertEquals("@foo..", RepositoryName.create("@foo..").toString()); - assertEquals("@.foo", RepositoryName.create("@.foo").toString()); - - assertNotValid("x", "workspace names must start with '@'"); - assertNotValid("@.", "workspace names are not allowed to be '@.'"); - assertNotValid("@..", "workspace names are not allowed to be '@..'"); - assertNotValid("@foo/bar", "workspace names may contain only A-Z, a-z, 0-9, '-', '_' and '.'"); - assertNotValid("@foo@", "workspace names may contain only A-Z, a-z, 0-9, '-', '_' and '.'"); - assertNotValid("@foo\0", "workspace names may contain only A-Z, a-z, 0-9, '-', '_' and '.'"); - } - @Test public void testToString() throws Exception { PackageIdentifier local = PackageIdentifier.create("", new PathFragment("bar/baz")); |