| 9 | ) |
| 10 | |
| 11 | func TestResolve(t *testing.T) { |
| 12 | cwd, err := os.Getwd() |
| 13 | assert.NoError(t, err) |
| 14 | |
| 15 | testCases := []struct { |
| 16 | in, out string |
| 17 | }{ |
| 18 | {"", ""}, // don't make wild guesses |
| 19 | {"C:\\alice\\\\foobar", "C:\\alice\\\\foobar"}, |
| 20 | {"\\foobar\\~\\noexpand", "\\foobar\\~\\noexpand"}, |
| 21 | {"\\no\\modification", "\\no\\modification"}, |
| 22 | {"relative", filepath.Join(cwd, "relative")}, |
| 23 | {"relative\\path", filepath.Join(cwd, "relative", "path")}, |
| 24 | } |
| 25 | |
| 26 | for _, tc := range testCases { |
| 27 | t.Run(tc.in, func(t *testing.T) { |
| 28 | desc := "'" + tc.in + "' should be normalized as '" + tc.out + "'" |
| 29 | assert.Equal(t, tc.out, Resolve(tc.in, ""), desc) |
| 30 | }) |
| 31 | } |
| 32 | } |