aboutsummaryrefslogtreecommitdiff
path: root/internal/ctlsock/sanitize_test.go
blob: dfcb62c271d40caaef18270391cc5d7935d17005 (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
package ctlsock

import (
	"testing"
)

func TestSanitizePath(t *testing.T) {
	testCases := [][]string{
		{"", ""},
		{".", ""},
		{"/", ""},
		{"foo", "foo"},
		{"/foo", "foo"},
		{"foo/", "foo"},
		{"/foo/", "foo"},
		{"/foo/./foo", "foo/foo"},
		{"./", ""},
	}
	for _, tc := range testCases {
		res := SanitizePath(tc[0])
		if res != tc[1] {
			t.Errorf("%q: got %q, want %q", tc[0], res, tc[1])
		}
	}
}