All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m12s
Test / Hakurei (push) Successful in 3m8s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m25s
Test / Flake checks (push) Successful in 1m40s
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)
|
|
}
|
|
})
|
|
}
|
|
}
|