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.rs37
1 files changed, 20 insertions, 17 deletions
diff --git a/helix-term/tests/test/commands/write.rs b/helix-term/tests/test/commands/write.rs
index f65352c7..7259b4e5 100644
--- a/helix-term/tests/test/commands/write.rs
+++ b/helix-term/tests/test/commands/write.rs
@@ -94,7 +94,10 @@ async fn test_buffer_close_concurrent() -> anyhow::Result<()> {
)
.await?;
- helpers::assert_file_has_content(file.as_file_mut(), &platform_line(&RANGE.end().to_string()))?;
+ helpers::assert_file_has_content(
+ file.as_file_mut(),
+ &LineFeedHandling::Native.apply(&RANGE.end().to_string()),
+ )?;
Ok(())
}
@@ -121,7 +124,7 @@ async fn test_write() -> anyhow::Result<()> {
file.as_file_mut().read_to_string(&mut file_content)?;
assert_eq!(
- helpers::platform_line("the gostak distims the doshes"),
+ LineFeedHandling::Native.apply("the gostak distims the doshes"),
file_content
);
@@ -138,7 +141,7 @@ async fn test_overwrite_protection() -> anyhow::Result<()> {
helpers::run_event_loop_until_idle(&mut app).await;
file.as_file_mut()
- .write_all(helpers::platform_line("extremely important content").as_bytes())?;
+ .write_all("extremely important content".as_bytes())?;
file.as_file_mut().flush()?;
file.as_file_mut().sync_all()?;
@@ -152,10 +155,7 @@ async fn test_overwrite_protection() -> anyhow::Result<()> {
let mut file_content = String::new();
file.as_file_mut().read_to_string(&mut file_content)?;
- assert_eq!(
- helpers::platform_line("extremely important content"),
- file_content
- );
+ assert_eq!("extremely important content", file_content);
Ok(())
}
@@ -182,7 +182,7 @@ async fn test_write_quit() -> anyhow::Result<()> {
file.as_file_mut().read_to_string(&mut file_content)?;
assert_eq!(
- helpers::platform_line("the gostak distims the doshes"),
+ LineFeedHandling::Native.apply("the gostak distims the doshes"),
file_content
);
@@ -210,7 +210,10 @@ async fn test_write_concurrent() -> anyhow::Result<()> {
let mut file_content = String::new();
file.as_file_mut().read_to_string(&mut file_content)?;
- assert_eq!(platform_line(&RANGE.end().to_string()), file_content);
+ assert_eq!(
+ LineFeedHandling::Native.apply(&RANGE.end().to_string()),
+ file_content
+ );
Ok(())
}
@@ -276,7 +279,7 @@ async fn test_write_scratch_to_new_path() -> anyhow::Result<()> {
)
.await?;
- helpers::assert_file_has_content(file.as_file_mut(), &helpers::platform_line("hello"))?;
+ helpers::assert_file_has_content(file.as_file_mut(), &LineFeedHandling::Native.apply("hello"))?;
Ok(())
}
@@ -361,12 +364,12 @@ async fn test_write_new_path() -> anyhow::Result<()> {
helpers::assert_file_has_content(
file1.as_file_mut(),
- &helpers::platform_line("i can eat glass, it will not hurt me\n"),
+ &LineFeedHandling::Native.apply("i can eat glass, it will not hurt me\n"),
)?;
helpers::assert_file_has_content(
file2.as_file_mut(),
- &helpers::platform_line("i can eat glass, it will not hurt me\n"),
+ &LineFeedHandling::Native.apply("i can eat glass, it will not hurt me\n"),
)?;
Ok(())
@@ -437,7 +440,7 @@ async fn test_write_insert_final_newline_added_if_missing() -> anyhow::Result<()
helpers::assert_file_has_content(
file.as_file_mut(),
- &helpers::platform_line("have you tried chamomile tea?\n"),
+ &LineFeedHandling::Native.apply("have you tried chamomile tea?\n"),
)?;
Ok(())
@@ -448,14 +451,14 @@ async fn test_write_insert_final_newline_unchanged_if_not_missing() -> anyhow::R
let mut file = tempfile::NamedTempFile::new()?;
let mut app = helpers::AppBuilder::new()
.with_file(file.path(), None)
- .with_input_text(&helpers::platform_line("#[t|]#en minutes, please\n"))
+ .with_input_text(LineFeedHandling::Native.apply("#[t|]#en minutes, please\n"))
.build()?;
test_key_sequence(&mut app, Some(":w<ret>"), None, false).await?;
helpers::assert_file_has_content(
file.as_file_mut(),
- &helpers::platform_line("ten minutes, please\n"),
+ &LineFeedHandling::Native.apply("ten minutes, please\n"),
)?;
Ok(())
@@ -508,12 +511,12 @@ async fn test_write_all_insert_final_newline_add_if_missing_and_modified() -> an
helpers::assert_file_has_content(
file1.as_file_mut(),
- &helpers::platform_line("we don't serve time travelers here\n"),
+ &LineFeedHandling::Native.apply("we don't serve time travelers here\n"),
)?;
helpers::assert_file_has_content(
file2.as_file_mut(),
- &helpers::platform_line("a time traveler walks into a bar\n"),
+ &LineFeedHandling::Native.apply("a time traveler walks into a bar\n"),
)?;
Ok(())