aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/sharefs/main_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-27 20:49:27 +0900
committerOphestra <cat@gensokyo.uk>2025-12-27 20:49:27 +0900
commitef1ebf12d98359c0d75ce48a1b05737f7e4e93c0 (patch)
tree4953ff9b2ee1ae400b3cf4ffb130f7da0650d514 /cmd/sharefs/main_test.go
parent775a9f57c9ec3bc6877e3973a8c4972558707375 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'cmd/sharefs/main_test.go')
-rw-r--r--cmd/sharefs/main_test.go29
1 files changed, 29 insertions, 0 deletions
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)
+ }
+ })
+ }
+}