Skip to content

Commit

Permalink
add an integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
savente93 committed Jun 10, 2024
1 parent 8d3a1d2 commit 3a88add
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
6 changes: 4 additions & 2 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,15 @@ fn parse_mark_register_contents(
let mut rv_iter = rv.into_iter();

let Some(doc_id) = rv_iter
.next().map(|c| c.into_owned())
.next()
.map(|c| c.into_owned())
.and_then(|s| s.try_into().ok())
else {
return Err(anyhow!("Register did not contain valid document id"));
};
let Some(history_rev) = rv_iter
.next().map(|c| c.into_owned())
.next()
.map(|c| c.into_owned())
.and_then(|s| s.parse().ok())
else {
return Err(anyhow!("Register did not contain valid revision number"));
Expand Down
30 changes: 20 additions & 10 deletions helix-term/tests/test/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,33 @@ async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> {
}

#[tokio::test(flavor = "multi_thread")]
async fn register_mark() -> anyhow::Result<()> {
async fn bookmark() -> anyhow::Result<()> {
// add a mark and then immediately paste it out
test((
indoc! {"\
Lorem
#[|Lorem]#
ipsum
dolor#[|
sit]#
amet."
#(|Lorem)#
ipsum
#(|Lorem)#
ipsum
#(|Lorem)#
ipsum
#(|Lorem)#
ipsum"
},
"1\"^p",
":register_mark<space>1<ret>casdf<esc>:goto_mark<space>1<ret>",
indoc! {"\
Lorem
#[|asdf]#
ipsum
#(|asdf)#
ipsum
#(|asdf)#
ipsum
#(|asdf)#
ipsum
dolor
sit#[|1:(24,19)]#
amet."
#(|asdf)#
ipsum"
},
))
.await?;
Expand Down

0 comments on commit 3a88add

Please sign in to comment.