(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestFilePathToParts(t *testing.T) { |
| 13 | t.Parallel() |
| 14 | |
| 15 | tests := []struct { |
| 16 | path string |
| 17 | expected []string |
| 18 | }{ |
| 19 | {"", []string{}}, |
| 20 | {"/", []string{}}, |
| 21 | {"foo", []string{"foo"}}, |
| 22 | {"/foo", []string{"foo"}}, |
| 23 | {"./foo/bar", []string{"foo", "bar"}}, |
| 24 | {"../foo/bar", []string{"..", "foo", "bar"}}, |
| 25 | {"foo/bar/baz", []string{"foo", "bar", "baz"}}, |
| 26 | {"/foo/bar/baz", []string{"foo", "bar", "baz"}}, |
| 27 | {"foo/../bar", []string{"bar"}}, |
| 28 | } |
| 29 | |
| 30 | for _, tt := range tests { |
| 31 | t.Run(fmt.Sprintf("`%s`", tt.path), func(t *testing.T) { |
| 32 | t.Parallel() |
| 33 | |
| 34 | parts := ignore.FilePathToParts(tt.path) |
| 35 | require.Equal(t, tt.expected, parts) |
| 36 | }) |
| 37 | } |
| 38 | } |
nothing calls this directly
no test coverage detected