Pretty print Diagnostics in snapshot tests (#3906)

This commit is contained in:
Micha Reiser 2023-04-11 11:03:00 +02:00 committed by GitHub
parent 210083bdd8
commit e8aebee3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
901 changed files with 55367 additions and 66782 deletions

View file

@ -36,20 +36,19 @@ mod tests {
use std::path::Path;
use anyhow::Result;
use insta::assert_yaml_snapshot;
use test_case::test_case;
use crate::registry::Rule;
use crate::settings;
use crate::test::test_path;
use crate::{assert_messages, settings};
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
let snapshot = format!("{}_{}", rule_code.as_ref(), path.to_string_lossy());
let diagnostics = test_path(
let messages = test_path(
Path::new("%s").join(path).as_path(),
&settings::Settings::for_rule(rule_code),
)?;
assert_yaml_snapshot!(snapshot, diagnostics);
assert_messages!(snapshot, diagnostics);
Ok(())
}
}