From ef1ebf12d98359c0d75ce48a1b05737f7e4e93c0 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 27 Dec 2025 20:49:27 +0900 Subject: cmd/sharefs: handle mount -t fuse.sharefs This should have been handled in a custom option parsing function, but that much extra complexity is unnecessary for this edge case. Honestly I do not know why libfuse does not handle this itself. Signed-off-by: Ophestra --- cmd/sharefs/main_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 cmd/sharefs/main_test.go (limited to 'cmd/sharefs/main_test.go') diff --git a/cmd/sharefs/main_test.go b/cmd/sharefs/main_test.go new file mode 100644 index 00000000..9498cd24 --- /dev/null +++ b/cmd/sharefs/main_test.go @@ -0,0 +1,29 @@ +package main + +import ( + "slices" + "testing" +) + +func TestHandleMountArgs(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + args []string + want []string + }{ + {"nil", nil, nil}, + {"passthrough", []string{"sharefs", "-V"}, []string{"sharefs", "-V"}}, + {"replace", []string{"/sbin/sharefs", "sharefs", "/sdcard", "-o", "rw"}, []string{"sharefs", "/sdcard", "-o", "rw"}}, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + if got := handleMountArgs(tc.args); !slices.Equal(got, tc.want) { + t.Errorf("handleMountArgs: %q, want %q", got, tc.want) + } + }) + } +} -- cgit v1.3.1