From b9940cd205678d8533f057e58e8d5ba1263e593f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 20 Jun 2024 18:54:01 +0100 Subject: [PATCH] tests: use println rather then eprintln in tests This should reduce the noise in output when a test is running and passing. --- crates/forge/src/tests.rs | 2 +- crates/git/src/repository/open/otest.rs | 4 ++-- crates/git/src/tests.rs | 10 +++++----- crates/git/src/validation/tests.rs | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/forge/src/tests.rs b/crates/forge/src/tests.rs index 49e190c..62f60e1 100644 --- a/crates/forge/src/tests.rs +++ b/crates/forge/src/tests.rs @@ -30,7 +30,7 @@ fn test_github_name() { fn given_fs() -> kxio::fs::FileSystem { kxio::fs::temp().unwrap_or_else(|e| { - eprintln!("{e}"); + println!("{e}"); panic!("fs") }) } diff --git a/crates/git/src/repository/open/otest.rs b/crates/git/src/repository/open/otest.rs index 337dfc6..e33d224 100644 --- a/crates/git/src/repository/open/otest.rs +++ b/crates/git/src/repository/open/otest.rs @@ -82,7 +82,7 @@ impl git::repository::OpenRepositoryLike for TestOpenRepository { .read() .map_err(|_| git::fetch::Error::Lock)? .deref(); - eprintln!("Fetch: {i}"); + println!("Fetch: {i}"); self.fetch_counter .write() .map_err(|_| git::fetch::Error::Lock) @@ -104,7 +104,7 @@ impl git::repository::OpenRepositoryLike for TestOpenRepository { .read() .map_err(|_| git::fetch::Error::Lock)? .deref(); - eprintln!("Push: {i}"); + println!("Push: {i}"); self.push_counter .write() .map_err(|_| git::fetch::Error::Lock) diff --git a/crates/git/src/tests.rs b/crates/git/src/tests.rs index 458b630..35dee26 100644 --- a/crates/git/src/tests.rs +++ b/crates/git/src/tests.rs @@ -450,22 +450,22 @@ pub mod then { } fn exec(label: String, output: Result) -> TestResult { - eprintln!("== {label}"); + println!("== {label}"); match output { Ok(output) => { - eprintln!( + println!( "\nstdout:\n{}", String::from_utf8_lossy(output.stdout.as_slice()) ); - eprintln!( + println!( "\nstderr:\n{}", String::from_utf8_lossy(output.stderr.as_slice()) ); - eprintln!("============================="); + println!("============================="); Ok(()) } Err(err) => { - eprintln!("ERROR: {err:#?}"); + println!("ERROR: {err:#?}"); Ok(Err(err)?) } } diff --git a/crates/git/src/validation/tests.rs b/crates/git/src/validation/tests.rs index 37d8c9a..c4bc7a5 100644 --- a/crates/git/src/validation/tests.rs +++ b/crates/git/src/validation/tests.rs @@ -343,7 +343,7 @@ mod positions { ); //then - eprintln!("Got: {err:?}"); + println!("Got: {err:?}"); // NOTE: assertions for correct push are in on_push above assert!(matches!( err, @@ -414,7 +414,7 @@ mod positions { ); //then - eprintln!("Got: {err:?}"); + println!("Got: {err:?}"); let_assert!( Ok(sha_next) = then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()), @@ -504,7 +504,7 @@ mod positions { ); //then - eprintln!("Got: {err:?}"); + println!("Got: {err:?}"); // NOTE: assertions for correct push are in on_push above assert!(matches!( err, @@ -573,7 +573,7 @@ mod positions { ); //then - eprintln!("Got: {err:?}"); + println!("Got: {err:?}"); let_assert!( Ok(sha_next) = then::get_sha_for_branch(&fs, &gitdir, &repo_config.branches().next()), @@ -626,7 +626,7 @@ mod positions { ); //then - eprintln!("positions: {positions:#?}"); + println!("positions: {positions:#?}"); let_assert!( Ok(main_sha) =