Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
idursun committed Nov 22, 2022
1 parent a20044a commit 9cb4598
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions helix-term/tests/test/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@ async fn test_write_quit_fail() -> anyhow::Result<()> {
}

#[tokio::test(flavor = "multi_thread")]
async fn test_read_file() -> anyhow::Result<()> {
let mut file = tempfile::NamedTempFile::new()?;
let expected_content = String::from("some contents");
let output_file = helpers::temp_file_with_contents(&expected_content)?;
let mut command = String::new();
let cmd = format!(":r {:?}<ret><esc>:w<ret>", output_file.path());
command.push_str(&cmd);

test_key_sequence(
&mut helpers::AppBuilder::new()
.with_file(file.path(), None)
.build()?,
Some(&command),
Some(&|app| {
assert!(!app.editor.is_err(), "error: {:?}", app.editor.get_status());
}),
false,
)
.await?;

helpers::assert_file_has_content(file.as_file_mut(), expected_content.as_str())?;

Ok(())
}

#[tokio::test(flavor = "multi_thread")]
#[ignore]
async fn test_buffer_close_concurrent() -> anyhow::Result<()> {
test_key_sequences(
&mut helpers::AppBuilder::new().build()?,
Expand Down

0 comments on commit 9cb4598

Please sign in to comment.