aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/check/overlay_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'container/check/overlay_test.go')
-rw-r--r--container/check/overlay_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/container/check/overlay_test.go b/container/check/overlay_test.go
new file mode 100644
index 00000000..bd90236d
--- /dev/null
+++ b/container/check/overlay_test.go
@@ -0,0 +1,27 @@
+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)
+ }
+ })
+ }
+}