aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/sharefs/main_test.go
blob: 9498cd24c39b096f2f08a389be2d2692a2ed9e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
			}
		})
	}
}