Merge pull request #3194 from bshelton229/literal-dollar-character

Make literal $ character work in set $location_path
This commit is contained in:
k8s-ci-robot 2018-10-09 15:52:39 -07:00 committed by GitHub
commit f56ab42cd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 1 deletions

View file

@ -858,3 +858,29 @@ func TestBuildUpstreamName(t *testing.T) {
}
}
}
func TestEscapeLiteralDollar(t *testing.T) {
escapedPath := escapeLiteralDollar("/$")
expected := "/${literal_dollar}"
if escapedPath != expected {
t.Errorf("Expected %v but returned %v", expected, escapedPath)
}
escapedPath = escapeLiteralDollar("/hello-$/world-$/")
expected = "/hello-${literal_dollar}/world-${literal_dollar}/"
if escapedPath != expected {
t.Errorf("Expected %v but returned %v", expected, escapedPath)
}
leaveUnchagned := "/leave-me/unchagned"
escapedPath = escapeLiteralDollar(leaveUnchagned)
if escapedPath != leaveUnchagned {
t.Errorf("Expected %v but returned %v", leaveUnchagned, escapedPath)
}
escapedPath = escapeLiteralDollar(false)
expected = ""
if escapedPath != expected {
t.Errorf("Expected %v but returned %v", expected, escapedPath)
}
}