use crate::e2e::codegen::inert_example::InertExample;
use tracing::warn;
pub(super) fn report_inert_examples(examples: &[InertExample]) {
for example in examples {
warn!("[{}] {}", example.language, example.reason());
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::e2e::codegen::inert_example::InertCause;
use tracing_test::traced_test;
#[test]
#[traced_test]
fn report_inert_examples_names_language_and_fixture() {
let examples = vec![InertExample {
language: "ruby".to_owned(),
fixture_id: "streaming_chunked_response".to_owned(),
markers: 0,
cause: InertCause::RenderedNothing,
}];
report_inert_examples(&examples);
assert!(logs_contain("ruby"), "the affected language must be named in the log");
assert!(
logs_contain("streaming_chunked_response"),
"the affected fixture must be named in the log"
);
}
#[test]
#[traced_test]
fn report_inert_examples_names_every_refusal_not_just_the_first() {
let examples = vec![
InertExample {
language: "python".to_owned(),
fixture_id: "first_fixture".to_owned(),
markers: 0,
cause: InertCause::RenderedNothing,
},
InertExample {
language: "go".to_owned(),
fixture_id: "second_fixture".to_owned(),
markers: 2,
cause: InertCause::AwaitedOrLimited,
},
];
report_inert_examples(&examples);
assert!(logs_contain("first_fixture"));
assert!(logs_contain("second_fixture"));
}
}