mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Isolate non-breaking whitespace indentation test case (#11721)
As discussed in Discord, this moves the test case for non-breaking whitespace into its own method.
This commit is contained in:
parent
8db147c09d
commit
2b28889ca9
1 changed files with 14 additions and 11 deletions
|
@ -214,6 +214,20 @@ x = (
|
|||
let stylist = Stylist::from_tokens(parsed.tokens(), &locator);
|
||||
assert_eq!(stylist.indentation(), &Indentation(" ".to_string()));
|
||||
|
||||
// formfeed indent, see `detect_indention` comment.
|
||||
let contents = r"
|
||||
class FormFeedIndent:
|
||||
def __init__(self, a=[]):
|
||||
print(a)
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let parsed = parse_module(contents).unwrap();
|
||||
let stylist = Stylist::from_tokens(parsed.tokens(), &locator);
|
||||
assert_eq!(stylist.indentation(), &Indentation(" ".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indent_non_breaking_whitespace() {
|
||||
let contents = r"
|
||||
x = (
|
||||
1,
|
||||
|
@ -227,17 +241,6 @@ x = (
|
|||
Stylist::from_tokens(parsed.tokens(), &locator).indentation(),
|
||||
&Indentation(" ".to_string())
|
||||
);
|
||||
|
||||
// formfeed indent, see `detect_indention` comment.
|
||||
let contents = r"
|
||||
class FormFeedIndent:
|
||||
def __init__(self, a=[]):
|
||||
print(a)
|
||||
";
|
||||
let locator = Locator::new(contents);
|
||||
let parsed = parse_module(contents).unwrap();
|
||||
let stylist = Stylist::from_tokens(parsed.tokens(), &locator);
|
||||
assert_eq!(stylist.indentation(), &Indentation(" ".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue