Optimize out empty path components
filepath.Join("foo", "") returns a newly allocated copy of "foo",
while filepath.Join("foo") does not. Strip out any empty path
components before calling filepath.Join.
Test: TestValidatePath
Change-Id: Ib47dbcd9d6463809acfe260dfd9af87ea280b4de
diff --git a/android/paths_test.go b/android/paths_test.go
index 2f87977..bf46c34 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -37,6 +37,22 @@
out: "",
},
{
+ in: []string{"", ""},
+ out: "",
+ },
+ {
+ in: []string{"a", ""},
+ out: "a",
+ },
+ {
+ in: []string{"", "a"},
+ out: "a",
+ },
+ {
+ in: []string{"", "a", ""},
+ out: "a",
+ },
+ {
in: []string{"a/b"},
out: "a/b",
},