Skip to content

Commit aa0d162

Browse files
committed
Improved error messages in ant tests
1 parent e624196 commit aa0d162

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

crates/plugins/java/src/ant_plugin.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -447,38 +447,30 @@ mod test {
447447
let cp = plugin.get_project_class_path(&test_path).unwrap();
448448

449449
let sep = std::path::MAIN_SEPARATOR;
450+
let expected_junit = format!("{0}{1}lib{1}junit-4.10.jar", test_path.display(), sep);
450451
assert!(
451-
cp.contains(&format!(
452-
"{0}{1}lib{1}junit-4.10.jar",
453-
test_path.display(),
454-
sep
455-
)),
456-
"Classpath {} did not contain junit",
457-
cp
452+
cp.contains(&expected_junit),
453+
"Classpath {cp} did not contain junit (looked for {expected_junit})",
454+
);
455+
let expected_utils = format!(
456+
"{0}{1}lib{1}edu-test-utils-0.4.1.jar",
457+
test_path.display(),
458+
sep
458459
);
459460
assert!(
460-
cp.contains(&format!(
461-
"{0}{1}lib{1}edu-test-utils-0.4.1.jar",
462-
test_path.display(),
463-
sep
464-
)),
465-
"Classpath {} did not contain edu-test-utils",
466-
cp
461+
cp.contains(&expected_utils),
462+
"Classpath {cp} did not contain edu-test-utils (looked for {expected_utils}",
467463
);
464+
let expected_classes = format!("{0}{1}build{1}classes", test_path.display(), sep);
468465
assert!(
469-
cp.contains(&format!("{0}{1}build{1}classes", test_path.display(), sep)),
470-
"Classpath {} did not contain build{}classes",
471-
cp,
472-
sep
466+
cp.contains(&expected_classes),
467+
"Classpath {cp} did not contain build{sep}classes (looked for {expected_classes}",
473468
);
469+
let expected_test_classes =
470+
format!("{0}{1}build{1}test{1}classes", test_path.display(), sep);
474471
assert!(
475-
cp.contains(&format!(
476-
"{0}{1}build{1}test{1}classes",
477-
test_path.display(),
478-
sep
479-
)),
480-
"Classpath {} did not contain build/test/classes",
481-
cp
472+
cp.contains(&expected_test_classes),
473+
"Classpath {cp} did not contain build/test/classes (looked for {expected_test_classes}",
482474
);
483475
// tools.jar is in java home, tricky to test
484476
/*

0 commit comments

Comments
 (0)