(test *testing.T)
| 228 | } |
| 229 | |
| 230 | func TestFileReadEmptyTreeOldSide(test *testing.T) { |
| 231 | access, err := NewComparisonCodeAccess(FileReader{Mode: ModeCommit, Ref: "HEAD"}, FileReader{Mode: ModeEmpty}) |
| 232 | if err != nil { |
| 233 | test.Fatal(err) |
| 234 | } |
| 235 | provider := FileReadProvider{Access: access} |
| 236 | for path, reason := range map[string]string{ |
| 237 | ".": `"." is a directory; file_read does not support directories.`, |
| 238 | "./": `"./" is a directory; file_read does not support directories.`, |
| 239 | "missing": `file "missing" does not exist in the empty tree.`, |
| 240 | } { |
| 241 | got, err := provider.Execute(test.Context(), map[string]any{"file_path": path, "side": "old"}) |
| 242 | var pathErr *FileReadPathError |
| 243 | if got != "" || !errors.As(err, &pathErr) || err.Error() != "SIDE: old\nSOURCE: empty-tree\n"+reason { |
| 244 | test.Errorf("old side %q: got %q, %v", path, got, err) |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | func TestWorkspaceCodeAccess(test *testing.T) { |
| 250 | current, previous := comparisonReaders(test) |
nothing calls this directly
no test coverage detected