mirror of
https://github.com/helix-editor/helix.git
synced 2024-12-23 08:21:54 +04:00
f5991657f4
Prior to this change, every integration test which wanted its line endings to be handled transparently across platforms, i.e. test with the same input that has its platform's line feed characters, converting the line endings was up to each individual test by calling the `platform_line` helper function. This significantly increases the amount of boilerplate one has to copy between all the tests. However, there are some test cases that need to exert strict control over the exact input text without being manipulated behind the scenes by the test framework. So, with this change, the line feed conversions are factored into the `TestCase` struct. By default, line endings of the input text are converted to the platform's native line feed ending, but one can explicitly specify in their test case when the input text should be left alone and tested as is.
42 lines
872 B
Rust
42 lines
872 B
Rust
use super::*;
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
async fn auto_indent() -> anyhow::Result<()> {
|
|
let app = || AppBuilder::new().with_file("foo.go", None);
|
|
|
|
let enter_tests = [
|
|
(
|
|
indoc! {r##"
|
|
type Test struct {#[}|]#
|
|
"##},
|
|
"i<ret>",
|
|
indoc! {"\
|
|
type Test struct {
|
|
\t#[|\n]#
|
|
}
|
|
"},
|
|
),
|
|
(
|
|
indoc! {"\
|
|
func main() {
|
|
\tswitch nil {#[}|]#
|
|
}
|
|
"},
|
|
"i<ret>",
|
|
indoc! {"\
|
|
func main() {
|
|
\tswitch nil {
|
|
\t\t#[|\n]#
|
|
\t}
|
|
}
|
|
"},
|
|
),
|
|
];
|
|
|
|
for test in enter_tests {
|
|
test_with_config(app(), test).await?;
|
|
}
|
|
|
|
Ok(())
|
|
}
|