fix: typo
This commit is contained in:
@@ -33,8 +33,9 @@ func translateReplacementBackrefs(raw string) string {
|
|||||||
|
|
||||||
for i := 0; i < len(raw); i++ {
|
for i := 0; i < len(raw); i++ {
|
||||||
if raw[i] == '\\' && i+1 < len(raw) && raw[i+1] >= '1' && raw[i+1] <= '9' {
|
if raw[i] == '\\' && i+1 < len(raw) && raw[i+1] >= '1' && raw[i+1] <= '9' {
|
||||||
b.WriteByte('$')
|
b.WriteString("${")
|
||||||
b.WriteByte(raw[i+1])
|
b.WriteByte(raw[i+1])
|
||||||
|
b.WriteByte('}')
|
||||||
i++
|
i++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package release
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestTranslateReplacementBackrefsWrapsCaptureNumbers(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
got := translateReplacementBackrefs(`\1git+https://example.test/ref\2`)
|
||||||
|
want := `${1}git+https://example.test/ref${2}`
|
||||||
|
if got != want {
|
||||||
|
t.Fatalf("translateReplacementBackrefs() = %q, want %q", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user