(t *testing.T)
| 508 | } |
| 509 | |
| 510 | func TestNewBasicFilesystem(t *testing.T) { |
| 511 | if build.IsWindows { |
| 512 | t.Skip("non-windows root paths") |
| 513 | } |
| 514 | |
| 515 | currentDir, err := filepath.Abs(".") |
| 516 | if err != nil { |
| 517 | t.Fatal(err) |
| 518 | } |
| 519 | testCases := []struct { |
| 520 | input string |
| 521 | expectedRoot string |
| 522 | expectedURI string |
| 523 | }{ |
| 524 | {"/foo/bar/baz", "/foo/bar/baz", "/foo/bar/baz"}, |
| 525 | {"/foo/bar/baz/", "/foo/bar/baz", "/foo/bar/baz"}, |
| 526 | {"", currentDir, currentDir}, |
| 527 | {".", currentDir, currentDir}, |
| 528 | {"/", "/", "/"}, |
| 529 | } |
| 530 | |
| 531 | for _, testCase := range testCases { |
| 532 | fs := newBasicFilesystem(testCase.input) |
| 533 | if fs.root != testCase.expectedRoot { |
| 534 | t.Errorf("root %q != %q", fs.root, testCase.expectedRoot) |
| 535 | } |
| 536 | if fs.URI() != testCase.expectedURI { |
| 537 | t.Errorf("uri %q != %q", fs.URI(), testCase.expectedURI) |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | fs := newBasicFilesystem("relative/path") |
| 542 | if fs.root == "relative/path" || !strings.HasPrefix(fs.root, string(PathSeparator)) { |
| 543 | t.Errorf(`newBasicFilesystem("relative/path").root == %q, expected absolutification`, fs.root) |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | func TestRel(t *testing.T) { |
| 548 | testCases := []struct { |
nothing calls this directly
no test coverage detected