| 1 | use super::*; |
| 2 | |
| 3 | const A: &str = indoc! {" |
| 4 | #(a|)# |
| 5 | #(b|)# |
| 6 | #(c|)# |
| 7 | #[d|]# |
| 8 | #(e|)#" |
| 9 | }; |
| 10 | const A_REV: &str = indoc! {" |
| 11 | #(e|)# |
| 12 | #[d|]# |
| 13 | #(c|)# |
| 14 | #(b|)# |
| 15 | #(a|)#" |
| 16 | }; |
| 17 | const B: &str = indoc! {" |
| 18 | #(a|)# |
| 19 | #(b|)# |
| 20 | #[c|]# |
| 21 | #(d|)# |
| 22 | #(e|)#" |
| 23 | }; |
| 24 | const B_REV: &str = indoc! {" |
| 25 | #(e|)# |
| 26 | #(d|)# |
| 27 | #[c|]# |
| 28 | #(b|)# |
| 29 | #(a|)#" |
| 30 | }; |
| 31 | |
| 32 | const CMD: &str = "<space>?reverse_selection_contents<ret>"; |
| 33 | |
| 34 | #[tokio::test(flavor = "multi_thread")] |
| 35 | async fn reverse_selection_contents() -> anyhow::Result<()> { |
| 36 | test((A, CMD, A_REV)).await?; |
| 37 | test((B, CMD, B_REV)).await?; |
| 38 | |
| 39 | Ok(()) |
| 40 | } |
| 41 | |
| 42 | #[tokio::test(flavor = "multi_thread")] |
| 43 | async fn reverse_selection_contents_with_count() -> anyhow::Result<()> { |
| 44 | test((B, format!("2{CMD}"), B)).await?; |
| 45 | test((B, format!("3{CMD}"), B_REV)).await?; |
| 46 | test((B, format!("4{CMD}"), B)).await?; |
| 47 | |
| 48 | Ok(()) |
| 49 | } |