Skip to content

Commit

Permalink
Fix physical_lines unit tests to take Indexer, reset cargo insta
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Apr 3, 2023
1 parent dca4605 commit 2c3ad96
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions crates/ruff/src/checkers/physical_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,24 @@ mod tests {
let line = "'\u{4e9c}' * 2"; // 7 in UTF-32, 9 in UTF-8.
let locator = Locator::new(line);
let tokens: Vec<_> = lex(line, Mode::Module).collect();
let indexer: Indexer = tokens.as_slice().into();
let stylist = Stylist::from_tokens(&tokens, &locator);

// let check_with_max_line_length = |line_length: usize| {
// check_physical_lines(
// Path::new("foo.py"),
// &locator,
// &stylist,
// &indexer,
// &[],
// &Settings {
// line_length,
// ..Settings::for_rule(Rule::LineTooLong)
// },
// flags::Autofix::Enabled,
// )
// };
// assert_eq!(check_with_max_line_length(8), vec![]);
// assert_eq!(check_with_max_line_length(8), vec![]);
// }
let check_with_max_line_length = |line_length: usize| {
check_physical_lines(
Path::new("foo.py"),
&locator,
&stylist,
&indexer,
&[],
&Settings {
line_length,
..Settings::for_rule(Rule::LineTooLong)
},
flags::Autofix::Enabled,
)
};
assert_eq!(check_with_max_line_length(8), vec![]);
assert_eq!(check_with_max_line_length(8), vec![]);
}
}

0 comments on commit 2c3ad96

Please sign in to comment.