(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestLexicallyCleanPath(t *testing.T) { |
| 56 | path := LexicallyCleanPath("") |
| 57 | if path != "" { |
| 58 | t.Errorf("expected to receive empty string and received %s", path) |
| 59 | } |
| 60 | |
| 61 | path = LexicallyCleanPath("rootfs") |
| 62 | if path != "rootfs" { |
| 63 | t.Errorf("expected to receive 'rootfs' and received %s", path) |
| 64 | } |
| 65 | |
| 66 | path = LexicallyCleanPath("../../../var") |
| 67 | if path != "var" { |
| 68 | t.Errorf("expected to receive 'var' and received %s", path) |
| 69 | } |
| 70 | |
| 71 | path = LexicallyCleanPath("/../../../var") |
| 72 | if path != "/var" { |
| 73 | t.Errorf("expected to receive '/var' and received %s", path) |
| 74 | } |
| 75 | |
| 76 | path = LexicallyCleanPath("/foo/bar/") |
| 77 | if path != "/foo/bar" { |
| 78 | t.Errorf("expected to receive '/foo/bar' and received %s", path) |
| 79 | } |
| 80 | |
| 81 | path = LexicallyCleanPath("/foo/bar/../") |
| 82 | if path != "/foo" { |
| 83 | t.Errorf("expected to receive '/foo' and received %s", path) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func TestLexicallyStripRoot(t *testing.T) { |
| 88 | for _, test := range []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…