1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

correctly show files with special chars in commit

This commit is contained in:
mjarkk
2021-07-23 12:04:23 +02:00
parent 9a087d04eb
commit fc76b44b45
5 changed files with 47 additions and 14 deletions

View File

@ -133,3 +133,35 @@ func TestPrevIndex(t *testing.T) {
})
}
}
func TestEscapeSpecialChars(t *testing.T) {
type scenario struct {
testName string
input string
expected string
}
scenarios := []scenario{
{
"normal string",
"ab",
"ab",
},
{
"string with a special char",
"a\nb",
"a\\nb",
},
{
"multiple special chars",
"\n\r\t\b\f\v",
"\\n\\r\\t\\b\\f\\v",
},
}
for _, s := range scenarios {
t.Run(s.testName, func(t *testing.T) {
assert.EqualValues(t, s.expected, EscapeSpecialChars(s.input))
})
}
}