mirror of https://github.com/astral-sh/ruff
[ty] Use diagnostic rendering for semantic token tests
This commit is contained in:
parent
e16473d260
commit
da6403b1bf
|
|
@ -242,6 +242,22 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn render_diagnostics<I, D>(&self, diagnostics: I) -> String
|
pub(super) fn render_diagnostics<I, D>(&self, diagnostics: I) -> String
|
||||||
|
where
|
||||||
|
I: IntoIterator<Item = D>,
|
||||||
|
D: IntoDiagnostic,
|
||||||
|
{
|
||||||
|
let config = DisplayDiagnosticConfig::default()
|
||||||
|
.color(false)
|
||||||
|
.format(DiagnosticFormat::Full);
|
||||||
|
|
||||||
|
self.render_diagnostics_with_config(diagnostics, &config)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn render_diagnostics_with_config<I, D>(
|
||||||
|
&self,
|
||||||
|
diagnostics: I,
|
||||||
|
config: &DisplayDiagnosticConfig,
|
||||||
|
) -> String
|
||||||
where
|
where
|
||||||
I: IntoIterator<Item = D>,
|
I: IntoIterator<Item = D>,
|
||||||
D: IntoDiagnostic,
|
D: IntoDiagnostic,
|
||||||
|
|
@ -250,12 +266,9 @@ mod tests {
|
||||||
|
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
||||||
let config = DisplayDiagnosticConfig::default()
|
|
||||||
.color(false)
|
|
||||||
.format(DiagnosticFormat::Full);
|
|
||||||
for diagnostic in diagnostics {
|
for diagnostic in diagnostics {
|
||||||
let diag = diagnostic.into_diagnostic();
|
let diag = diagnostic.into_diagnostic();
|
||||||
write!(buf, "{}", diag.display(&self.db, &config)).unwrap();
|
write!(buf, "{}", diag.display(&self.db, config)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
buf
|
buf
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue