forked from security/hakurei
This is used in hst to format strings. Signed-off-by: Ophestra <cat@gensokyo.uk>
28 lines
534 B
Go
28 lines
534 B
Go
package check_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"hakurei.app/container/check"
|
|
)
|
|
|
|
func TestEscapeOverlayDataSegment(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
s string
|
|
want string
|
|
}{
|
|
{"zero", "", ""},
|
|
{"multi", `\\\:,:,\\\`, `\\\\\\\:\,\:\,\\\\\\`},
|
|
{"bwrap", `/path :,\`, `/path \:\,\\`},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := check.EscapeOverlayDataSegment(tc.s); got != tc.want {
|
|
t.Errorf("escapeOverlayDataSegment: %s, want %s", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|