@@ -22,144 +22,7 @@ mod integration {
2222 Ok(())
2323 }
2424
25− #[tokio::test]
26− async fn insert_mode_cursor_position() -> anyhow::Result<()> {
27− test_key_sequence_text_result(
28− Args::default(),
29− Config::default(),
30− TestCase {
31− in_text: String::new(),
32− in_selection: Selection::single(0, 0),
33− in_keys: "i".into(),
34− out_text: String::new(),
35− out_selection: Selection::single(0, 0),
36− },
37− )?;
38−
39− test_key_sequence_text_result(
40− Args::default(),
41− Config::default(),
42− ("#[\n|]#", "i", "#[|\n]#"),
43− )?;
44−
45− test_key_sequence_text_result(
46− Args::default(),
47− Config::default(),
48− ("#[\n|]#", "i<esc>", "#[|\n]#"),
49− )?;
50−
51− test_key_sequence_text_result(
52− Args::default(),
53− Config::default(),
54− ("#[\n|]#", "i<esc>i", "#[|\n]#"),
55− )?;
56−
57− Ok(())
58− }
59−
60− /// Range direction is preserved when escaping insert mode to normal
61− #[tokio::test]
62− async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> {
63− test_key_sequence_text_result(
64− Args::default(),
65− Config::default(),
66− ("#[f|]#oo\n", "vll<A-;><esc>", "#[|foo]#\n"),
67− )?;
68−
69− test_key_sequence_text_result(
70− Args::default(),
71− Config::default(),
72− (
73− indoc! {"\
74− #[f|]#oo
75− #(b|)#ar"
76− },
77− "vll<A-;><esc>",
78− indoc! {"\
79− #[|foo]#
80− #(|bar)#"
81− },
82− ),
83− )?;
84−
85− test_key_sequence_text_result(
86− Args::default(),
87− Config::default(),
88− (
89− indoc! {"\
90− #[f|]#oo
91− #(b|)#ar"
92− },
93− "a",
94− indoc! {"\
95− #[fo|]#o
96− #(ba|)#r"
97− },
98− ),
99− )?;
100−
101− test_key_sequence_text_result(
102− Args::default(),
103− Config::default(),
104− (
105− indoc! {"\
106− #[f|]#oo
107− #(b|)#ar"
108− },
109− "a<esc>",
110− indoc! {"\
111− #[f|]#oo
112− #(b|)#ar"
113− },
114− ),
115− )?;
116−
117− Ok(())
118− }
119−
120− #[tokio::test]
121− async fn auto_pairs_basic() -> anyhow::Result<()> {
122− test_key_sequence_text_result(
123− Args::default(),
124− Config::default(),
125− ("#[\n|]#", "i(<esc>", "(#[|)]#\n"),
126− )?;
127−
128− test_key_sequence_text_result(
129− Args::default(),
130− Config {
131− editor: helix_view::editor::Config {
132− auto_pairs: AutoPairConfig::Enable(false),
133− ..Default::default()
134− },
135− ..Default::default()
136− },
137− ("#[\n|]#", "i(<esc>", "(#[|\n]#"),
138− )?;
139−
140− Ok(())
141− }
142−
143− #[tokio::test]
144− async fn auto_indent_c() -> anyhow::Result<()> {
145− test_key_sequence_text_result(
146− Args {
147− files: vec![(PathBuf::from("foo.c"), Position::default())],
148− ..Default::default()
149− },
150− Config::default(),
151− // switches to append mode?
152− (
153− "void foo() {#[|}]#\n",
154− "i<ret><esc>",
155− indoc! {"\
156− void foo() {
157− #[|\n]#\
158− }
159− "},
160− ),
161− )?;
162−
163− Ok(())
164− }
25+ mod auto_indent;
26+ mod auto_pairs;
27+ mod movement;
16528}