replacer: Fix escaped closing braces (#5995)

This commit is contained in:
Aziz Rmadi
2024-01-13 14:24:03 -06:00
committed by GitHub
parent c839a98ff5
commit 80acf1bf23
4 changed files with 70 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ func TestReplacer(t *testing.T) {
},
{
input: `\}`,
expect: `\}`,
expect: `}`,
},
{
input: "{}",
@@ -164,6 +164,10 @@ func TestReplacer(t *testing.T) {
input: string([]byte{0x26, 0x00, 0x83, 0x7B, 0x84, 0x07, 0x5C, 0x7D, 0x84}),
expect: string([]byte{0x26, 0x00, 0x83, 0x7B, 0x84, 0x07, 0x7D, 0x84}),
},
{
input: `\\}`,
expect: `\}`,
},
} {
actual := rep.ReplaceAll(tc.input, tc.empty)
if actual != tc.expect {