Use bazel syntax for fully qualified name in path property

A module reference to a fully qualified module in a path property looks
like:
  //path:module
And with a tag:
  //path:module{tag}

At the moment the checking is quite lax but some follow up changes will
make it much stricter.

Bug: 193228441
Test: m nothing
Change-Id: Ie42edcfa33ec66fda5d75b3df1da73f56f147afd
This commit is contained in:
Paul Duffin
2021-07-12 20:12:12 +01:00
parent 407501b82c
commit e6ba0723b1
3 changed files with 101 additions and 34 deletions

View File

@@ -55,6 +55,27 @@ func TestSrcIsModule(t *testing.T) {
},
wantModule: "foo:bar",
},
{
name: "fully qualified",
args: args{
s: "//foo:bar",
},
wantModule: "//foo:bar",
},
{
name: "fully qualified with tag",
args: args{
s: "//foo:bar{.tag}",
},
wantModule: "//foo:bar{.tag}",
},
{
name: "invalid unqualified name",
args: args{
s: ":foo/bar",
},
wantModule: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -128,6 +149,35 @@ func TestSrcIsModuleWithTag(t *testing.T) {
},
wantModule: "foo.bar}",
},
{
name: "fully qualified",
args: args{
s: "//foo:bar",
},
wantModule: "//foo:bar",
},
{
name: "fully qualified with tag",
args: args{
s: "//foo:bar{.tag}",
},
wantModule: "//foo:bar",
wantTag: ".tag",
},
{
name: "invalid unqualified name",
args: args{
s: ":foo/bar",
},
wantModule: "",
},
{
name: "invalid unqualified name with tag",
args: args{
s: ":foo/bar{.tag}",
},
wantModule: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {