From 1533f489340fb63eee31c12122d6233cb5f6abaf Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Mon, 25 Apr 2022 20:25:16 -0400 Subject: use Results in integration tests for more error context --- helix-term/tests/integration/movement.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'helix-term/tests/integration/movement.rs') diff --git a/helix-term/tests/integration/movement.rs b/helix-term/tests/integration/movement.rs index cac10852..e0bfc3bf 100644 --- a/helix-term/tests/integration/movement.rs +++ b/helix-term/tests/integration/movement.rs @@ -109,8 +109,8 @@ async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> { /// the first grapheme #[tokio::test] async fn cursor_position_newly_opened_file() -> anyhow::Result<()> { - let test = |content: &str, expected_sel: Selection| { - let file = helpers::temp_file_with_contents(content); + let test = |content: &str, expected_sel: Selection| -> anyhow::Result<()> { + let file = helpers::temp_file_with_contents(content)?; let mut app = Application::new( Args { @@ -118,17 +118,18 @@ async fn cursor_position_newly_opened_file() -> anyhow::Result<()> { ..Default::default() }, Config::default(), - ) - .unwrap(); + )?; let (view, doc) = helix_view::current!(app.editor); let sel = doc.selection(view.id).clone(); assert_eq!(expected_sel, sel); + + Ok(()) }; - test("foo", Selection::single(0, 1)); - test("๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ foo", Selection::single(0, 7)); - test("", Selection::single(0, 0)); + test("foo", Selection::single(0, 1))?; + test("๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ foo", Selection::single(0, 7))?; + test("", Selection::single(0, 0))?; Ok(()) } -- cgit v1.2.3-70-g09d2