[ty] Use dedent in cursor tests (#20019)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run

This commit is contained in:
Micha Reiser 2025-08-21 10:31:54 +02:00 committed by GitHub
parent a5cbca156c
commit 045cba382a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 596 additions and 595 deletions

View file

@ -287,6 +287,7 @@ mod tests {
use ruff_db::diagnostic::{Diagnostic, DiagnosticFormat, DisplayDiagnosticConfig};
use ruff_db::files::{File, system_path_to_file};
use ruff_db::system::{DbWithWritableSystem, SystemPath, SystemPathBuf};
use ruff_python_trivia::textwrap::dedent;
use ruff_text_size::TextSize;
use ty_project::ProjectMetadata;
use ty_python_semantic::{
@ -417,12 +418,12 @@ mod tests {
pub(super) fn source(
&mut self,
path: impl Into<SystemPathBuf>,
contents: impl Into<String>,
contents: impl AsRef<str>,
) -> &mut CursorTestBuilder {
const MARKER: &str = "<CURSOR>";
let path = path.into();
let contents = contents.into();
let contents = dedent(contents.as_ref()).into_owned();
let Some(cursor_offset) = contents.find(MARKER) else {
self.sources.push(Source {
path,