summaryrefslogtreecommitdiff
path: root/android/module_test.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-07-12 20:12:12 +0100
committer Paul Duffin <paulduffin@google.com> 2021-07-12 20:15:06 +0100
commite6ba0723b18a0e60724fce8726809856b130a568 (patch)
treef53f3d38a12a7ca125200a9c15643ca4f147a31c /android/module_test.go
parent407501b82c4a66f88c715e49deca8647c5fe1509 (diff)
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
Diffstat (limited to 'android/module_test.go')
-rw-r--r--android/module_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/android/module_test.go b/android/module_test.go
index 9ac929179..9e2b0ca29 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -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) {