Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defmt-test: improve output formatting #297

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions firmware/defmt-test/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,8 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result<TokenStrea
let unit_test_blocks = tests.iter().map(|test| &test.block);
let unit_test_running = tests
.iter()
.map(|test| format!("running {} ..", test.ident))
.collect::<Vec<_>>();
let unit_test_done = tests
.iter()
.map(|test| format!(".. {} ok", test.ident))
.enumerate()
.map(|(i, test)| format!("({}/{}) running `{}`...", i + 1, tests.len(), test.ident))
.collect::<Vec<_>>();
Ok(quote!(mod #ident {
#(#imports)*
Expand All @@ -207,9 +204,9 @@ fn tests_impl(args: TokenStream, input: TokenStream) -> parse::Result<TokenStrea
#(
defmt::info!(#unit_test_running);
#unit_test_calls
defmt::info!(#unit_test_done);
)*

defmt::info!("all tests passed!");
#krate::export::exit()
}

Expand Down