Debian Codegraph @

helix-term/tests/test/commands/rotate_selection_contents.rs

raw symbols SCIP
1 use super::*;
2
3 // Progression: A -> B -> C -> D
4 // as we press `A-)`
5 const A: &str = indoc! {"
6 #(a|)#
7 #(b|)#
8 #(c|)#
9 #[d|]#
10 #(e|)#"
11 };
12
13 const B: &str = indoc! {"
14 #(e|)#
15 #(a|)#
16 #(b|)#
17 #(c|)#
18 #[d|]#"
19 };
20
21 const C: &str = indoc! {"
22 #[d|]#
23 #(e|)#
24 #(a|)#
25 #(b|)#
26 #(c|)#"
27 };
28
29 const D: &str = indoc! {"
30 #(c|)#
31 #[d|]#
32 #(e|)#
33 #(a|)#
34 #(b|)#"
35 };
36
37 #[tokio::test(flavor = "multi_thread")]
38 async fn rotate_selection_contents_forward_repeated() -> anyhow::Result<()> {
39 test((A, "<A-)>", B)).await?;
40 test((B, "<A-)>", C)).await?;
41 test((C, "<A-)>", D)).await?;
42
43 Ok(())
44 }
45
46 #[tokio::test(flavor = "multi_thread")]
47 async fn rotate_selection_contents_forward_with_count() -> anyhow::Result<()> {
48 test((A, "2<A-)>", C)).await?;
49 test((A, "3<A-)>", D)).await?;
50 test((B, "2<A-)>", D)).await?;
51
52 Ok(())
53 }
54
55 #[tokio::test(flavor = "multi_thread")]
56 async fn rotate_selection_contents_backward_repeated() -> anyhow::Result<()> {
57 test((D, "<A-(>", C)).await?;
58 test((C, "<A-(>", B)).await?;
59 test((B, "<A-(>", A)).await?;
60
61 Ok(())
62 }
63
64 #[tokio::test(flavor = "multi_thread")]
65 async fn rotate_selection_contents_backward_with_count() -> anyhow::Result<()> {
66 test((D, "2<A-(>", B)).await?;
67 test((D, "3<A-(>", A)).await?;
68 test((C, "2<A-(>", A)).await?;
69
70 Ok(())
71 }