Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands/write.rs')
-rw-r--r--helix-term/tests/test/commands/write.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands/write.rs b/helix-term/tests/test/commands/write.rs
index 38ab643c..f7123f68 100644
--- a/helix-term/tests/test/commands/write.rs
+++ b/helix-term/tests/test/commands/write.rs
@@ -483,6 +483,21 @@ async fn test_write_insert_final_newline_added_if_missing() -> anyhow::Result<()
}
#[tokio::test(flavor = "multi_thread")]
+async fn test_write_insert_final_newline_unchanged_if_empty() -> anyhow::Result<()> {
+ let mut file = tempfile::NamedTempFile::new()?;
+ let mut app = helpers::AppBuilder::new()
+ .with_file(file.path(), None)
+ .with_input_text("#[|]#")
+ .build()?;
+
+ test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;
+
+ helpers::assert_file_has_content(&mut file, "")?;
+
+ Ok(())
+}
+
+#[tokio::test(flavor = "multi_thread")]
async fn test_write_insert_final_newline_unchanged_if_not_missing() -> anyhow::Result<()> {
let mut file = tempfile::NamedTempFile::new()?;
let mut app = helpers::AppBuilder::new()