(t *testing.T)
| 178 | } |
| 179 | |
| 180 | func TestRel(t *testing.T) { |
| 181 | t.Parallel() |
| 182 | testRel(t, ".", "", "") |
| 183 | testRel(t, ".", "", ".") |
| 184 | testRel(t, ".", ".", "") |
| 185 | testRel(t, ".", ".", ".") |
| 186 | testRel(t, ".", "foo", "foo") |
| 187 | testRel(t, "foo", ".", "foo") |
| 188 | testRel(t, "foo", ".", "./foo") |
| 189 | testRel(t, "foo/bar", ".", "foo/bar") |
| 190 | testRel(t, "bar", "c:\\foo", "c:\\foo\\bar") |
| 191 | testRel(t, "bar", "foo", "foo/bar") |
| 192 | testRel(t, "baz", "c:\\foo/./bar", "c:\\foo\\bar\\baz") |
| 193 | testRel(t, "baz", "foo/./bar", "foo/bar/baz") |
| 194 | |
| 195 | // This would require querying the current directory to know what |
| 196 | // Drive `\` refers to. |
| 197 | testRelError(t, "", "\\foo\\bar", "c:\\foo\\bar") |
| 198 | |
| 199 | testRelError(t, "", "..", "foo/bar") |
| 200 | testRelError(t, "", "c:\\foo", "d:\\bar") |
| 201 | testRelError(t, "", "\\\\127.0.0.1\\$c\\foo", "\\\\127.0.0.1\\$d\\foo") |
| 202 | } |
| 203 | |
| 204 | func testRel(t *testing.T, expected string, basepath string, targpath string) { |
| 205 | rel, err := Rel(basepath, targpath) |
nothing calls this directly
no test coverage detected
searching dependent graphs…