TestReadFileTruncatesOversizeContent: ReadFile obeys the same Truncate head+tail cap as every other tool. Oversize content must carry the marker so the model re-reads a slice rather than trusting a silently-clipped blob.
(t *testing.T)
| 40 | // head+tail cap as every other tool. Oversize content must carry the marker so |
| 41 | // the model re-reads a slice rather than trusting a silently-clipped blob. |
| 42 | func TestReadFileTruncatesOversizeContent(t *testing.T) { |
| 43 | dir := t.TempDir() |
| 44 | path := filepath.Join(dir, "big.txt") |
| 45 | // Over ToolOutputCap*4 bytes so Truncate fires. |
| 46 | big := strings.Repeat("x", chmctx.ToolOutputCap*4+1000) |
| 47 | if err := os.WriteFile(path, []byte(big), 0o644); err != nil { |
| 48 | t.Fatal(err) |
| 49 | } |
| 50 | got := ReadFile(path) |
| 51 | if !strings.Contains(got, "───── truncated") { |
| 52 | t.Fatalf("oversize read should carry the truncation marker, got %d bytes without it", len(got)) |
| 53 | } |
| 54 | if len(got) >= len(big) { |
| 55 | t.Fatalf("oversize read was not shortened: got %d bytes, source %d", len(got), len(big)) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestReadFileSchemaShape(t *testing.T) { |
| 60 | sch := ReadFileSchema() |
nothing calls this directly
no test coverage detected