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:
@ -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))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user