MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_read_with_offset_and_limit

Function test_read_with_offset_and_limit

core/src/tools/builtin/read.rs:148–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146
147 #[tokio::test]
148 async fn test_read_with_offset_and_limit() {
149 let temp = tempfile::tempdir().unwrap();
150 let file = temp.path().join("test.txt");
151 std::fs::write(&file, "a\nb\nc\nd\ne\n").unwrap();
152
153 let tool = ReadTool;
154 let ctx = ToolContext::new(temp.path().to_path_buf());
155 let result = tool
156 .execute(
157 &serde_json::json!({"file_path": "test.txt", "offset": 1, "limit": 2}),
158 &ctx,
159 )
160 .await
161 .unwrap();
162
163 assert!(result.success);
164 assert!(result.content.contains("b"));
165 assert!(result.content.contains("c"));
166 assert!(!result.content.contains("\ta\n"));
167 }
168
169 #[tokio::test]
170 async fn test_read_missing_file() {

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
pathMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected