Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands.rs')
| -rw-r--r-- | helix-term/tests/test/commands.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 351f07fe..6b904aa3 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -640,3 +640,27 @@ async fn test_join_selections_space() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_read_file() -> anyhow::Result<()> { + let mut file = tempfile::NamedTempFile::new()?; + let contents_to_read = "some contents"; + let output_file = helpers::temp_file_with_contents(contents_to_read)?; + + test_key_sequence( + &mut helpers::AppBuilder::new() + .with_file(file.path(), None) + .build()?, + Some(&format!(":r {:?}<ret><esc>:w<ret>", output_file.path())), + Some(&|app| { + assert!(!app.editor.is_err(), "error: {:?}", app.editor.get_status()); + }), + false, + ) + .await?; + + let expected_contents = LineFeedHandling::Native.apply(contents_to_read); + helpers::assert_file_has_content(&mut file, &expected_contents)?; + + Ok(()) +} |