aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/sharefs/main_test.go
diff options
context:
space:
mode:
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)
+ }
+ })
+ }
+}