tests: use println rather then eprintln in tests

This should reduce the noise in output when a test is running and passing.
This commit is contained in:
Paul Campbell 2024-06-20 18:54:01 +01:00
parent 8ce4528c88
commit b9940cd205
4 changed files with 13 additions and 13 deletions

View file

@ -30,7 +30,7 @@ fn test_github_name() {
fn given_fs() -> kxio::fs::FileSystem { fn given_fs() -> kxio::fs::FileSystem {
kxio::fs::temp().unwrap_or_else(|e| { kxio::fs::temp().unwrap_or_else(|e| {
eprintln!("{e}"); println!("{e}");
panic!("fs") panic!("fs")
}) })
} }

View file

@ -82,7 +82,7 @@ impl git::repository::OpenRepositoryLike for TestOpenRepository {
.read() .read()
.map_err(|_| git::fetch::Error::Lock)? .map_err(|_| git::fetch::Error::Lock)?
.deref(); .deref();
eprintln!("Fetch: {i}"); println!("Fetch: {i}");
self.fetch_counter self.fetch_counter
.write() .write()
.map_err(|_| git::fetch::Error::Lock) .map_err(|_| git::fetch::Error::Lock)
@ -104,7 +104,7 @@ impl git::repository::OpenRepositoryLike for TestOpenRepository {
.read() .read()
.map_err(|_| git::fetch::Error::Lock)? .map_err(|_| git::fetch::Error::Lock)?
.deref(); .deref();
eprintln!("Push: {i}"); println!("Push: {i}");
self.push_counter self.push_counter
.write() .write()
.map_err(|_| git::fetch::Error::Lock) .map_err(|_| git::fetch::Error::Lock)

View file

@ -450,22 +450,22 @@ pub mod then {
} }
fn exec(label: String, output: Result<std::process::Output, std::io::Error>) -> TestResult { fn exec(label: String, output: Result<std::process::Output, std::io::Error>) -> TestResult {
eprintln!("== {label}"); println!("== {label}");
match output { match output {
Ok(output) => { Ok(output) => {
eprintln!( println!(
"\nstdout:\n{}", "\nstdout:\n{}",
String::from_utf8_lossy(output.stdout.as_slice()) String::from_utf8_lossy(output.stdout.as_slice())
); );
eprintln!( println!(
"\nstderr:\n{}", "\nstderr:\n{}",
String::from_utf8_lossy(output.stderr.as_slice()) String::from_utf8_lossy(output.stderr.as_slice())
); );
eprintln!("============================="); println!("=============================");
Ok(()) Ok(())
} }
Err(err) => { Err(err) => {
eprintln!("ERROR: {err:#?}"); println!("ERROR: {err:#?}");
Ok(Err(err)?) Ok(Err(err)?)
} }
} }

View file

@ -343,7 +343,7 @@ mod positions {
); );
//then //then
eprintln!("Got: {err:?}"); println!("Got: {err:?}");
// NOTE: assertions for correct push are in on_push above // NOTE: assertions for correct push are in on_push above
assert!(matches!( assert!(matches!(
err, err,
@ -414,7 +414,7 @@ mod positions {
); );
//then //then
eprintln!("Got: {err:?}"); println!("Got: {err:?}");
let_assert!( let_assert!(
Ok(sha_next) = Ok(sha_next) =
then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()), then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()),
@ -504,7 +504,7 @@ mod positions {
); );
//then //then
eprintln!("Got: {err:?}"); println!("Got: {err:?}");
// NOTE: assertions for correct push are in on_push above // NOTE: assertions for correct push are in on_push above
assert!(matches!( assert!(matches!(
err, err,
@ -573,7 +573,7 @@ mod positions {
); );
//then //then
eprintln!("Got: {err:?}"); println!("Got: {err:?}");
let_assert!( let_assert!(
Ok(sha_next) = Ok(sha_next) =
then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()), then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()),
@ -626,7 +626,7 @@ mod positions {
); );
//then //then
eprintln!("positions: {positions:#?}"); println!("positions: {positions:#?}");
let_assert!( let_assert!(
Ok(main_sha) = Ok(main_sha) =