Skip to content

Commit

Permalink
Add test for insert-final-newline set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
zqianem committed Sep 11, 2023
1 parent 5c1bc48 commit 453a486
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions helix-term/tests/test/commands/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,31 @@ async fn test_write_insert_final_newline_unchanged_if_not_missing() -> anyhow::R
Ok(())
}

#[tokio::test(flavor = "multi_thread")]
async fn test_write_insert_final_newline_unchanged_if_missing_and_false() -> anyhow::Result<()> {
let mut file = tempfile::NamedTempFile::new()?;
let mut app = helpers::AppBuilder::new()
.with_config(Config {
editor: helix_view::editor::Config {
insert_final_newline: false,
..Default::default()
},
..Default::default()
})
.with_file(file.path(), None)
.with_input_text("#[t|]#he quiet rain continued through the night")
.build()?;

test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;

helpers::assert_file_has_content(
file.as_file_mut(),
"the quiet rain continued through the night",
)?;

Ok(())
}

#[tokio::test(flavor = "multi_thread")]
async fn test_write_all_insert_final_newline_add_if_missing_and_modified() -> anyhow::Result<()> {
let mut file1 = tempfile::NamedTempFile::new()?;
Expand Down

0 comments on commit 453a486

Please sign in to comment.