(t *testing.T)
| 90 | } |
| 91 | |
| 92 | func TestReadDirOnFile(t *testing.T) { |
| 93 | // Create a temporary test file |
| 94 | tmpFile, err := os.CreateTemp("", "readdir_test_file") |
| 95 | if err != nil { |
| 96 | t.Fatalf("Failed to create temp file: %v", err) |
| 97 | } |
| 98 | defer os.Remove(tmpFile.Name()) |
| 99 | tmpFile.Close() |
| 100 | |
| 101 | // Test reading a file (should fail) |
| 102 | input := map[string]any{ |
| 103 | "path": tmpFile.Name(), |
| 104 | } |
| 105 | |
| 106 | _, err = readDirCallback(input, &uctypes.UIMessageDataToolUse{}) |
| 107 | if err == nil { |
| 108 | t.Fatalf("Expected error when reading a file with read_dir, got nil") |
| 109 | } |
| 110 | |
| 111 | expectedErrSubstr := "path is not a directory" |
| 112 | if err.Error()[:len(expectedErrSubstr)] != expectedErrSubstr { |
| 113 | t.Errorf("Expected error containing %q, got %q", expectedErrSubstr, err.Error()) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func TestReadDirMaxEntries(t *testing.T) { |
| 118 | // Create a temporary test directory with many files |
nothing calls this directly
no test coverage detected