Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use super::*;

const A: &str = indoc! {"
    #(a|)#
    #(b|)#
    #(c|)#
    #[d|]#
    #(e|)#"
};
const A_REV: &str = indoc! {"
    #(e|)#
    #[d|]#
    #(c|)#
    #(b|)#
    #(a|)#"
};
const B: &str = indoc! {"
    #(a|)#
    #(b|)#
    #[c|]#
    #(d|)#
    #(e|)#"
};
const B_REV: &str = indoc! {"
    #(e|)#
    #(d|)#
    #[c|]#
    #(b|)#
    #(a|)#"
};

const CMD: &str = "<space>?reverse_selection_contents<ret>";

#[tokio::test(flavor = "multi_thread")]
async fn reverse_selection_contents() -> anyhow::Result<()> {
    test((A, CMD, A_REV)).await?;
    test((B, CMD, B_REV)).await?;

    Ok(())
}

#[tokio::test(flavor = "multi_thread")]
async fn reverse_selection_contents_with_count() -> anyhow::Result<()> {
    test((B, format!("2{CMD}"), B)).await?;
    test((B, format!("3{CMD}"), B_REV)).await?;
    test((B, format!("4{CMD}"), B)).await?;

    Ok(())
}