aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/check/overlay_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-07 23:56:19 +0900
committerOphestra <cat@gensokyo.uk>2025-10-07 23:56:19 +0900
commit1f0226f7e01822a2a5b37d8626b59b7b6f4d0144 (patch)
tree47ca771c20a1073f4c2743c7c1b4189f66ddf336 /container/check/overlay_test.go
parent584ce3da685352847e5c6189e5050bd5cb0307e9 (diff)
container/check: relocate overlay escape
This is used in hst to format strings. Signed-off-by: Ophestra <cat@gensokyo.uk>
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)
+ }
+ })
+ }
+}