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:
Dhruv Manilawala 2024-06-03 18:50:55 +05:30 committed by GitHub
parent 8db147c09d
commit 2b28889ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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]