Skip to content

Commit 0bbb843

Browse files
committed
rust +nightly fmt
1 parent 121930d commit 0bbb843

File tree

4 files changed

+16
-32
lines changed

4 files changed

+16
-32
lines changed

crates/agent/src/agent/tools/fs_write.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,7 @@ mod tests {
389389

390390
#[tokio::test]
391391
async fn test_str_replace_single_occurrence() {
392-
let test_base = TestBase::new()
393-
.await
394-
.with_file(("test.txt", "hello world"))
395-
.await;
392+
let test_base = TestBase::new().await.with_file(("test.txt", "hello world")).await;
396393

397394
let tool = FsWrite::StrReplace(StrReplace {
398395
path: test_base.join("test.txt").to_string_lossy().to_string(),
@@ -409,10 +406,7 @@ mod tests {
409406

410407
#[tokio::test]
411408
async fn test_str_replace_multiple_occurrences() {
412-
let test_base = TestBase::new()
413-
.await
414-
.with_file(("test.txt", "foo bar foo"))
415-
.await;
409+
let test_base = TestBase::new().await.with_file(("test.txt", "foo bar foo")).await;
416410

417411
let tool = FsWrite::StrReplace(StrReplace {
418412
path: test_base.join("test.txt").to_string_lossy().to_string(),
@@ -429,10 +423,7 @@ mod tests {
429423

430424
#[tokio::test]
431425
async fn test_str_replace_no_match() {
432-
let test_base = TestBase::new()
433-
.await
434-
.with_file(("test.txt", "hello world"))
435-
.await;
426+
let test_base = TestBase::new().await.with_file(("test.txt", "hello world")).await;
436427

437428
let tool = FsWrite::StrReplace(StrReplace {
438429
path: test_base.join("test.txt").to_string_lossy().to_string(),
@@ -465,10 +456,7 @@ mod tests {
465456

466457
#[tokio::test]
467458
async fn test_insert_append() {
468-
let test_base = TestBase::new()
469-
.await
470-
.with_file(("test.txt", "existing"))
471-
.await;
459+
let test_base = TestBase::new().await.with_file(("test.txt", "existing")).await;
472460

473461
let tool = FsWrite::Insert(Insert {
474462
path: test_base.join("test.txt").to_string_lossy().to_string(),

crates/agent/src/agent/tools/image_read.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,7 @@ mod tests {
254254

255255
#[tokio::test]
256256
async fn test_read_valid_image() {
257-
let test_base = TestBase::new()
258-
.await
259-
.with_file(("test.png", create_test_png()))
260-
.await;
257+
let test_base = TestBase::new().await.with_file(("test.png", create_test_png())).await;
261258

262259
let tool = ImageRead {
263260
paths: vec![test_base.join("test.png").to_string_lossy().to_string()],
@@ -294,10 +291,7 @@ mod tests {
294291

295292
#[tokio::test]
296293
async fn test_validate_unsupported_format() {
297-
let test_base = TestBase::new()
298-
.await
299-
.with_file(("test.txt", "not an image"))
300-
.await;
294+
let test_base = TestBase::new().await.with_file(("test.txt", "not an image")).await;
301295

302296
let tool = ImageRead {
303297
paths: vec![test_base.join("test.txt").to_string_lossy().to_string()],

crates/agent/src/agent/tools/ls.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,7 @@ mod tests {
450450

451451
#[tokio::test]
452452
async fn test_ls_validate_file_not_directory() {
453-
let test_base = TestBase::new()
454-
.await
455-
.with_file(("file.txt", "content"))
456-
.await;
453+
let test_base = TestBase::new().await.with_file(("file.txt", "content")).await;
457454

458455
let tool = Ls {
459456
path: test_base.join("file.txt").to_string_lossy().to_string(),

crates/agent/src/agent/util/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ pub fn is_integ_test() -> bool {
142142
mod tests {
143143
use super::*;
144144

145-
146145
#[test]
147146
fn test_truncate_safe() {
148147
assert_eq!(truncate_safe("Hello World", 5), "Hello");
@@ -208,17 +207,23 @@ mod tests {
208207
.await;
209208

210209
// Test not truncated
211-
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 100, "...").await.unwrap();
210+
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 100, "...")
211+
.await
212+
.unwrap();
212213
assert_eq!(content, test_file);
213214
assert_eq!(bytes_truncated, 0);
214215

215216
// Test truncated
216-
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 10, "...").await.unwrap();
217+
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 10, "...")
218+
.await
219+
.unwrap();
217220
assert_eq!(content, "1234567...");
218221
assert_eq!(bytes_truncated, 23);
219222

220223
// Test suffix greater than max length
221-
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 1, "...").await.unwrap();
224+
let (content, bytes_truncated) = read_file_with_max_limit(test_base.join("test.txt"), 1, "...")
225+
.await
226+
.unwrap();
222227
assert_eq!(content, "");
223228
assert_eq!(bytes_truncated, 30);
224229
}

0 commit comments

Comments
 (0)