diff options
author | 2015-09-15 13:56:14 +0000 | |
---|---|---|
committer | 2015-09-15 20:27:47 +0000 | |
commit | a6434361097c0ee18c706bf7a86a93324f68e284 (patch) | |
tree | 98a3109cb41b1f6cbcb5bae4f9452fdb81553ae4 /src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java | |
parent | 5d737d642623749c8672916548b7c7c85b2ca9e6 (diff) |
Parse the label syntax "@//a:b" so that eventually we can make that the syntax that means "refer to the main repository".
There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways.
--
MOS_MIGRATED_REVID=103088960
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java b/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java index 322fb64e46..2ac874c5a8 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/LabelTest.java @@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; -import com.google.devtools.build.lib.syntax.Label.SyntaxException; +import com.google.devtools.build.lib.cmdline.LabelSyntaxException; import com.google.devtools.build.lib.testutil.TestUtils; import com.google.devtools.build.lib.vfs.PathFragment; @@ -60,7 +60,7 @@ public class LabelTest { } } - private static String parseCommandLine(String label, String prefix) throws SyntaxException { + private static String parseCommandLine(String label, String prefix) throws LabelSyntaxException { return Label.parseCommandLineLabel(label, new PathFragment(prefix)).toString(); } @@ -91,7 +91,7 @@ public class LabelTest { try { parseCommandLine("//absolute:A+bad%syntax", ""); fail(); - } catch (SyntaxException e) { + } catch (LabelSyntaxException e) { // Expected exception } } @@ -112,25 +112,25 @@ public class LabelTest { try { base.getRelative("/p1/p2:target"); fail(); - } catch (Label.SyntaxException e) { + } catch (LabelSyntaxException e) { /* ok */ } try { base.getRelative("quux:"); fail(); - } catch (Label.SyntaxException e) { + } catch (LabelSyntaxException e) { /* ok */ } try { base.getRelative(":"); fail(); - } catch (Label.SyntaxException e) { + } catch (LabelSyntaxException e) { /* ok */ } try { base.getRelative("::"); fail(); - } catch (Label.SyntaxException e) { + } catch (LabelSyntaxException e) { /* ok */ } } @@ -186,7 +186,7 @@ public class LabelTest { try { Label.parseAbsolute(label); fail("Label '" + label + "' did not contain a syntax error"); - } catch (SyntaxException e) { + } catch (LabelSyntaxException e) { assertContainsRegex(Pattern.quote(expectedError), e.getMessage()); } } @@ -358,7 +358,7 @@ public class LabelTest { try { Label.parseAbsolute("foo//bar/baz:bat/boo"); fail(); - } catch (SyntaxException e) { + } catch (LabelSyntaxException e) { assertThat(e).hasMessage("invalid repository name 'foo': workspace name must start with '@'"); } } |