All checks were successful
Test / Sandbox (push) Successful in 2m21s
Test / Hakurei (push) Successful in 3m23s
Test / Sandbox (race detector) (push) Successful in 4m22s
Test / Hpkg (push) Successful in 4m14s
Test / Hakurei (race detector) (push) Successful in 5m8s
Test / Flake checks (push) Successful in 1m22s
Test / Create distribution (push) Successful in 37s
Signed-off-by: Ophestra <cat@gensokyo.uk>
43 lines
904 B
Go
43 lines
904 B
Go
package container
|
|
|
|
import "testing"
|
|
|
|
func TestToSysroot(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
want string
|
|
}{
|
|
{"", "/sysroot"},
|
|
{"/", "/sysroot"},
|
|
{"//etc///", "/sysroot/etc"},
|
|
}
|
|
for _, tc := range testCases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := toSysroot(tc.name); got != tc.want {
|
|
t.Errorf("toSysroot: %q, want %q", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestToHost(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
want string
|
|
}{
|
|
{"", "/host"},
|
|
{"/", "/host"},
|
|
{"//etc///", "/host/etc"},
|
|
}
|
|
for _, tc := range testCases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := toHost(tc.name); got != tc.want {
|
|
t.Errorf("toHost: %q, want %q", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// InternalToHostOvlEscape exports toHost passed to EscapeOverlayDataSegment.
|
|
func InternalToHostOvlEscape(s string) string { return EscapeOverlayDataSegment(toHost(s)) }
|