(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestPathTraversalErrorMessage(t *testing.T) { |
| 103 | t.Parallel() |
| 104 | |
| 105 | pathTraversalError := safepaths.PathTraversalError{ |
| 106 | Base: mustParseAbsolute("/base"), |
| 107 | Elems: []string{".."}, |
| 108 | } |
| 109 | expectedMsg := fmt.Sprintf("joining %s and %s would be a traversal", filepath.Join(rootDir(), "base"), "..") |
| 110 | require.EqualError(t, pathTraversalError, expectedMsg) |
| 111 | } |
| 112 | |
| 113 | func mustParseAbsolute(s string) safepaths.Absolute { |
| 114 | t, err := safepaths.ParseAbsolute(s) |
nothing calls this directly
no test coverage detected