mirror of
https://github.com/astral-sh/ruff
synced 2026-01-25 15:30:53 -05:00
30 lines
913 B
Rust
30 lines
913 B
Rust
pub(crate) mod rules;
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use std::convert::AsRef;
|
|
use std::path::Path;
|
|
|
|
use anyhow::Result;
|
|
use test_case::test_case;
|
|
|
|
use crate::linter::test_path;
|
|
use crate::registry::RuleCode;
|
|
use crate::settings;
|
|
|
|
#[test_case(RuleCode::PIE790, Path::new("PIE790.py"); "PIE790")]
|
|
#[test_case(RuleCode::PIE794, Path::new("PIE794.py"); "PIE794")]
|
|
#[test_case(RuleCode::PIE807, Path::new("PIE807.py"); "PIE807")]
|
|
fn rules(rule_code: RuleCode, path: &Path) -> Result<()> {
|
|
let snapshot = format!("{}_{}", rule_code.as_ref(), path.to_string_lossy());
|
|
let diagnostics = test_path(
|
|
Path::new("./resources/test/fixtures/flake8_pie")
|
|
.join(path)
|
|
.as_path(),
|
|
&settings::Settings::for_rule(rule_code),
|
|
)?;
|
|
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
|
Ok(())
|
|
}
|
|
}
|