Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands/insert.rs')
| -rw-r--r-- | helix-term/tests/test/commands/insert.rs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands/insert.rs b/helix-term/tests/test/commands/insert.rs new file mode 100644 index 00000000..5450cc4c --- /dev/null +++ b/helix-term/tests/test/commands/insert.rs @@ -0,0 +1,53 @@ +use super::*; + +#[tokio::test(flavor = "multi_thread")] +async fn insert_newline_trim_trailing_whitespace() -> anyhow::Result<()> { + // Trailing whitespace is trimmed. + test(( + indoc! {"\ + hello·······#[| + ]#world + "} + .replace('·', " "), + "i<ret>", + indoc! {"\ + hello + #[| + ]#world + "} + .replace('·', " "), + )) + .await?; + + // Whitespace that would become trailing is trimmed too. + test(( + indoc! {"\ + hello········#[|w]#orld + "} + .replace('·', " "), + "i<ret>", + indoc! {"\ + hello + #[|w]#orld + "} + .replace('·', " "), + )) + .await?; + + // Only whitespace before the cursor is trimmed. + test(( + indoc! {"\ + hello········#[|·]#····world + "} + .replace('·', " "), + "i<ret>", + indoc! {"\ + hello + #[|·]#····world + "} + .replace('·', " "), + )) + .await?; + + Ok(()) +} |