diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/cmdline/LabelTest.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/cmdline/LabelTest.java b/src/test/java/com/google/devtools/build/lib/cmdline/LabelTest.java index 47dd0b1d67..3766a76755 100644 --- a/src/test/java/com/google/devtools/build/lib/cmdline/LabelTest.java +++ b/src/test/java/com/google/devtools/build/lib/cmdline/LabelTest.java @@ -21,13 +21,11 @@ import static org.junit.Assert.fail; import com.google.devtools.build.lib.testutil.TestUtils; import com.google.devtools.build.lib.vfs.PathFragment; - +import java.util.regex.Pattern; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import java.util.regex.Pattern; - /** * Tests for {@link Label}. */ @@ -55,6 +53,12 @@ public class LabelTest { assertEquals("", l.getPackageName()); assertEquals("bar", l.getName()); } + { + Label l = Label.parseAbsolute("@foo"); + assertEquals("@foo", l.getPackageIdentifier().getRepository().getName()); + assertEquals("", l.getPackageName()); + assertEquals("foo", l.getName()); + } } private static String parseCommandLine(String label, String prefix) throws LabelSyntaxException { @@ -249,6 +253,10 @@ public class LabelTest { Label l = Label.parseAbsolute("//foo/bar"); assertEquals("//foo/bar:bar", l.toString()); } + { + Label l = Label.parseAbsolute("@foo"); + assertEquals("@foo//:foo", l.toString()); + } } @Test @@ -434,7 +442,7 @@ public class LabelTest { "invalid repository name 'foo': workspace names must start with '@'"); } } - + @Test public void testGetWorkspaceRoot() throws Exception { Label label = Label.parseAbsolute("//bar/baz"); |