on master help sign in
flush writes on force quit (#4397)
f486f34Skyler Hawthorne
helix-term/src/commands/typed.rs+1
@@ -51,6 +51,7 @@ fn force_quit(
51
51
52 ensure!(args.is_empty(), ":quit! takes no arguments");
52 ensure!(args.is_empty(), ":quit! takes no arguments");
53
53
54+ cx.block_try_flush_writes()?;
54 cx.editor.close(view!(cx.editor).id);
55 cx.editor.close(view!(cx.editor).id);
55
56
56 Ok(())
57 Ok(())
helix-term/tests/integration.rs+1−1
@@ -11,7 +11,7 @@ mod test {
11
11
12 use self::helpers::*;
12 use self::helpers::*;
13
13
14− #[tokio::test]
14+ #[tokio::test(flavor = "multi_thread")]
15 async fn hello_world() -> anyhow::Result<()> {
15 async fn hello_world() -> anyhow::Result<()> {
16 test(("#[\n|]#", "ihello world<esc>", "hello world#[|\n]#")).await?;
16 test(("#[\n|]#", "ihello world<esc>", "hello world#[|\n]#")).await?;
17 Ok(())
17 Ok(())
helix-term/tests/test/auto_indent.rs+1−1
@@ -1,6 +1,6 @@
1use super::*;
1use super::*;
2
2
3−#[tokio::test]
3+#[tokio::test(flavor = "multi_thread")]
4async fn auto_indent_c() -> anyhow::Result<()> {
4async fn auto_indent_c() -> anyhow::Result<()> {
5 test_with_config(
5 test_with_config(
6 Args {
6 Args {
helix-term/tests/test/auto_pairs.rs+25−25
@@ -12,7 +12,7 @@ fn matching_pairs() -> impl Iterator<Item = &'static (char, char)> {
12 DEFAULT_PAIRS.iter().filter(|(open, close)| open == close)
12 DEFAULT_PAIRS.iter().filter(|(open, close)| open == close)
13}
13}
14
14
15−#[tokio::test]
15+#[tokio::test(flavor = "multi_thread")]
16async fn insert_basic() -> anyhow::Result<()> {
16async fn insert_basic() -> anyhow::Result<()> {
17 for pair in DEFAULT_PAIRS {
17 for pair in DEFAULT_PAIRS {
18 test((
18 test((
@@ -26,7 +26,7 @@ async fn insert_basic() -> anyhow::Result<()> {
26 Ok(())
26 Ok(())
27}
27}
28
28
29−#[tokio::test]
29+#[tokio::test(flavor = "multi_thread")]
30async fn insert_configured_multi_byte_chars() -> anyhow::Result<()> {
30async fn insert_configured_multi_byte_chars() -> anyhow::Result<()> {
31 // NOTE: these are multi-byte Unicode characters
31 // NOTE: these are multi-byte Unicode characters
32 let pairs = hashmap!('„' => '“', '‚' => '‘', '「' => '」');
32 let pairs = hashmap!('„' => '“', '‚' => '‘', '「' => '」');
@@ -68,7 +68,7 @@ async fn insert_configured_multi_byte_chars() -> anyhow::Result<()> {
68 Ok(())
68 Ok(())
69}
69}
70
70
71−#[tokio::test]
71+#[tokio::test(flavor = "multi_thread")]
72async fn insert_after_word() -> anyhow::Result<()> {
72async fn insert_after_word() -> anyhow::Result<()> {
73 for pair in differing_pairs() {
73 for pair in differing_pairs() {
74 test((
74 test((
@@ -91,7 +91,7 @@ async fn insert_after_word() -> anyhow::Result<()> {
91 Ok(())
91 Ok(())
92}
92}
93
93
94−#[tokio::test]
94+#[tokio::test(flavor = "multi_thread")]
95async fn insert_before_word() -> anyhow::Result<()> {
95async fn insert_before_word() -> anyhow::Result<()> {
96 for pair in DEFAULT_PAIRS {
96 for pair in DEFAULT_PAIRS {
97 test((
97 test((
@@ -105,7 +105,7 @@ async fn insert_before_word() -> anyhow::Result<()> {
105 Ok(())
105 Ok(())
106}
106}
107
107
108−#[tokio::test]
108+#[tokio::test(flavor = "multi_thread")]
109async fn insert_before_word_selection() -> anyhow::Result<()> {
109async fn insert_before_word_selection() -> anyhow::Result<()> {
110 for pair in DEFAULT_PAIRS {
110 for pair in DEFAULT_PAIRS {
111 test((
111 test((
@@ -119,7 +119,7 @@ async fn insert_before_word_selection() -> anyhow::Result<()> {
119 Ok(())
119 Ok(())
120}
120}
121
121
122−#[tokio::test]
122+#[tokio::test(flavor = "multi_thread")]
123async fn insert_before_word_selection_trailing_word() -> anyhow::Result<()> {
123async fn insert_before_word_selection_trailing_word() -> anyhow::Result<()> {
124 for pair in differing_pairs() {
124 for pair in differing_pairs() {
125 test((
125 test((
@@ -133,7 +133,7 @@ async fn insert_before_word_selection_trailing_word() -> anyhow::Result<()> {
133 Ok(())
133 Ok(())
134}
134}
135
135
136−#[tokio::test]
136+#[tokio::test(flavor = "multi_thread")]
137async fn insert_closer_selection_trailing_word() -> anyhow::Result<()> {
137async fn insert_closer_selection_trailing_word() -> anyhow::Result<()> {
138 for pair in differing_pairs() {
138 for pair in differing_pairs() {
139 test((
139 test((
@@ -147,7 +147,7 @@ async fn insert_closer_selection_trailing_word() -> anyhow::Result<()> {
147 Ok(())
147 Ok(())
148}
148}
149
149
150−#[tokio::test]
150+#[tokio::test(flavor = "multi_thread")]
151async fn insert_before_eol() -> anyhow::Result<()> {
151async fn insert_before_eol() -> anyhow::Result<()> {
152 for pair in DEFAULT_PAIRS {
152 for pair in DEFAULT_PAIRS {
153 test((
153 test((
@@ -166,7 +166,7 @@ async fn insert_before_eol() -> anyhow::Result<()> {
166 Ok(())
166 Ok(())
167}
167}
168
168
169−#[tokio::test]
169+#[tokio::test(flavor = "multi_thread")]
170async fn insert_auto_pairs_disabled() -> anyhow::Result<()> {
170async fn insert_auto_pairs_disabled() -> anyhow::Result<()> {
171 for pair in DEFAULT_PAIRS {
171 for pair in DEFAULT_PAIRS {
172 test_with_config(
172 test_with_config(
@@ -191,7 +191,7 @@ async fn insert_auto_pairs_disabled() -> anyhow::Result<()> {
191 Ok(())
191 Ok(())
192}
192}
193
193
194−#[tokio::test]
194+#[tokio::test(flavor = "multi_thread")]
195async fn insert_multi_range() -> anyhow::Result<()> {
195async fn insert_multi_range() -> anyhow::Result<()> {
196 for pair in DEFAULT_PAIRS {
196 for pair in DEFAULT_PAIRS {
197 test((
197 test((
@@ -210,7 +210,7 @@ async fn insert_multi_range() -> anyhow::Result<()> {
210 Ok(())
210 Ok(())
211}
211}
212
212
213−#[tokio::test]
213+#[tokio::test(flavor = "multi_thread")]
214async fn insert_before_multi_code_point_graphemes() -> anyhow::Result<()> {
214async fn insert_before_multi_code_point_graphemes() -> anyhow::Result<()> {
215 for pair in differing_pairs() {
215 for pair in differing_pairs() {
216 test((
216 test((
@@ -223,7 +223,7 @@ async fn insert_before_multi_code_point_graphemes() -> anyhow::Result<()> {
223 Ok(())
223 Ok(())
224}
224}
225
225
226−#[tokio::test]
226+#[tokio::test(flavor = "multi_thread")]
227async fn insert_at_end_of_document() -> anyhow::Result<()> {
227async fn insert_at_end_of_document() -> anyhow::Result<()> {
228 for pair in DEFAULT_PAIRS {
228 for pair in DEFAULT_PAIRS {
229 test(TestCase {
229 test(TestCase {
@@ -248,7 +248,7 @@ async fn insert_at_end_of_document() -> anyhow::Result<()> {
248 Ok(())
248 Ok(())
249}
249}
250
250
251−#[tokio::test]
251+#[tokio::test(flavor = "multi_thread")]
252async fn insert_close_inside_pair() -> anyhow::Result<()> {
252async fn insert_close_inside_pair() -> anyhow::Result<()> {
253 for pair in DEFAULT_PAIRS {
253 for pair in DEFAULT_PAIRS {
254 test((
254 test((
@@ -272,7 +272,7 @@ async fn insert_close_inside_pair() -> anyhow::Result<()> {
272 Ok(())
272 Ok(())
273}
273}
274
274
275−#[tokio::test]
275+#[tokio::test(flavor = "multi_thread")]
276async fn insert_close_inside_pair_multi() -> anyhow::Result<()> {
276async fn insert_close_inside_pair_multi() -> anyhow::Result<()> {
277 for pair in DEFAULT_PAIRS {
277 for pair in DEFAULT_PAIRS {
278 test((
278 test((
@@ -296,7 +296,7 @@ async fn insert_close_inside_pair_multi() -> anyhow::Result<()> {
296 Ok(())
296 Ok(())
297}
297}
298
298
299−#[tokio::test]
299+#[tokio::test(flavor = "multi_thread")]
300async fn insert_nested_open_inside_pair() -> anyhow::Result<()> {
300async fn insert_nested_open_inside_pair() -> anyhow::Result<()> {
301 for pair in differing_pairs() {
301 for pair in differing_pairs() {
302 test((
302 test((
@@ -320,7 +320,7 @@ async fn insert_nested_open_inside_pair() -> anyhow::Result<()> {
320 Ok(())
320 Ok(())
321}
321}
322
322
323−#[tokio::test]
323+#[tokio::test(flavor = "multi_thread")]
324async fn insert_nested_open_inside_pair_multi() -> anyhow::Result<()> {
324async fn insert_nested_open_inside_pair_multi() -> anyhow::Result<()> {
325 for outer_pair in DEFAULT_PAIRS {
325 for outer_pair in DEFAULT_PAIRS {
326 for inner_pair in DEFAULT_PAIRS {
326 for inner_pair in DEFAULT_PAIRS {
@@ -352,7 +352,7 @@ async fn insert_nested_open_inside_pair_multi() -> anyhow::Result<()> {
352 Ok(())
352 Ok(())
353}
353}
354
354
355−#[tokio::test]
355+#[tokio::test(flavor = "multi_thread")]
356async fn append_basic() -> anyhow::Result<()> {
356async fn append_basic() -> anyhow::Result<()> {
357 for pair in DEFAULT_PAIRS {
357 for pair in DEFAULT_PAIRS {
358 test((
358 test((
@@ -371,7 +371,7 @@ async fn append_basic() -> anyhow::Result<()> {
371 Ok(())
371 Ok(())
372}
372}
373
373
374−#[tokio::test]
374+#[tokio::test(flavor = "multi_thread")]
375async fn append_multi_range() -> anyhow::Result<()> {
375async fn append_multi_range() -> anyhow::Result<()> {
376 for pair in DEFAULT_PAIRS {
376 for pair in DEFAULT_PAIRS {
377 test((
377 test((
@@ -390,7 +390,7 @@ async fn append_multi_range() -> anyhow::Result<()> {
390 Ok(())
390 Ok(())
391}
391}
392
392
393−#[tokio::test]
393+#[tokio::test(flavor = "multi_thread")]
394async fn append_close_inside_pair() -> anyhow::Result<()> {
394async fn append_close_inside_pair() -> anyhow::Result<()> {
395 for pair in DEFAULT_PAIRS {
395 for pair in DEFAULT_PAIRS {
396 test((
396 test((
@@ -414,7 +414,7 @@ async fn append_close_inside_pair() -> anyhow::Result<()> {
414 Ok(())
414 Ok(())
415}
415}
416
416
417−#[tokio::test]
417+#[tokio::test(flavor = "multi_thread")]
418async fn append_close_inside_pair_multi() -> anyhow::Result<()> {
418async fn append_close_inside_pair_multi() -> anyhow::Result<()> {
419 for pair in DEFAULT_PAIRS {
419 for pair in DEFAULT_PAIRS {
420 test((
420 test((
@@ -438,7 +438,7 @@ async fn append_close_inside_pair_multi() -> anyhow::Result<()> {
438 Ok(())
438 Ok(())
439}
439}
440
440
441−#[tokio::test]
441+#[tokio::test(flavor = "multi_thread")]
442async fn append_end_of_word() -> anyhow::Result<()> {
442async fn append_end_of_word() -> anyhow::Result<()> {
443 for pair in differing_pairs() {
443 for pair in differing_pairs() {
444 test((
444 test((
@@ -457,7 +457,7 @@ async fn append_end_of_word() -> anyhow::Result<()> {
457 Ok(())
457 Ok(())
458}
458}
459
459
460−#[tokio::test]
460+#[tokio::test(flavor = "multi_thread")]
461async fn append_middle_of_word() -> anyhow::Result<()> {
461async fn append_middle_of_word() -> anyhow::Result<()> {
462 for pair in differing_pairs() {
462 for pair in differing_pairs() {
463 test((
463 test((
@@ -471,7 +471,7 @@ async fn append_middle_of_word() -> anyhow::Result<()> {
471 Ok(())
471 Ok(())
472}
472}
473
473
474−#[tokio::test]
474+#[tokio::test(flavor = "multi_thread")]
475async fn append_end_of_word_multi() -> anyhow::Result<()> {
475async fn append_end_of_word_multi() -> anyhow::Result<()> {
476 for pair in differing_pairs() {
476 for pair in differing_pairs() {
477 test((
477 test((
@@ -490,7 +490,7 @@ async fn append_end_of_word_multi() -> anyhow::Result<()> {
490 Ok(())
490 Ok(())
491}
491}
492
492
493−#[tokio::test]
493+#[tokio::test(flavor = "multi_thread")]
494async fn append_inside_nested_pair() -> anyhow::Result<()> {
494async fn append_inside_nested_pair() -> anyhow::Result<()> {
495 for pair in differing_pairs() {
495 for pair in differing_pairs() {
496 test((
496 test((
@@ -514,7 +514,7 @@ async fn append_inside_nested_pair() -> anyhow::Result<()> {
514 Ok(())
514 Ok(())
515}
515}
516
516
517−#[tokio::test]
517+#[tokio::test(flavor = "multi_thread")]
518async fn append_inside_nested_pair_multi() -> anyhow::Result<()> {
518async fn append_inside_nested_pair_multi() -> anyhow::Result<()> {
519 for outer_pair in DEFAULT_PAIRS {
519 for outer_pair in DEFAULT_PAIRS {
520 for inner_pair in DEFAULT_PAIRS {
520 for inner_pair in DEFAULT_PAIRS {
helix-term/tests/test/commands.rs+1−1
@@ -94,7 +94,7 @@ async fn test_buffer_close_concurrent() -> anyhow::Result<()> {
94 Ok(())
94 Ok(())
95}
95}
96
96
97−#[tokio::test]
97+#[tokio::test(flavor = "multi_thread")]
98async fn test_selection_duplication() -> anyhow::Result<()> {
98async fn test_selection_duplication() -> anyhow::Result<()> {
99 // Forward
99 // Forward
100 test((
100 test((
helix-term/tests/test/movement.rs+7−7
@@ -1,6 +1,6 @@
1use super::*;
1use super::*;
2
2
3−#[tokio::test]
3+#[tokio::test(flavor = "multi_thread")]
4async fn insert_mode_cursor_position() -> anyhow::Result<()> {
4async fn insert_mode_cursor_position() -> anyhow::Result<()> {
5 test(TestCase {
5 test(TestCase {
6 in_text: String::new(),
6 in_text: String::new(),
@@ -19,7 +19,7 @@ async fn insert_mode_cursor_position() -> anyhow::Result<()> {
19}
19}
20
20
21/// Range direction is preserved when escaping insert mode to normal
21/// Range direction is preserved when escaping insert mode to normal
22−#[tokio::test]
22+#[tokio::test(flavor = "multi_thread")]
23async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> {
23async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> {
24 test(("#[f|]#oo\n", "vll<A-;><esc>", "#[|foo]#\n")).await?;
24 test(("#[f|]#oo\n", "vll<A-;><esc>", "#[|foo]#\n")).await?;
25 test((
25 test((
@@ -66,7 +66,7 @@ async fn insert_to_normal_mode_cursor_position() -> anyhow::Result<()> {
66
66
67/// Ensure the very initial cursor in an opened file is the width of
67/// Ensure the very initial cursor in an opened file is the width of
68/// the first grapheme
68/// the first grapheme
69−#[tokio::test]
69+#[tokio::test(flavor = "multi_thread")]
70async fn cursor_position_newly_opened_file() -> anyhow::Result<()> {
70async fn cursor_position_newly_opened_file() -> anyhow::Result<()> {
71 let test = |content: &str, expected_sel: Selection| -> anyhow::Result<()> {
71 let test = |content: &str, expected_sel: Selection| -> anyhow::Result<()> {
72 let file = helpers::temp_file_with_contents(content)?;
72 let file = helpers::temp_file_with_contents(content)?;
@@ -88,7 +88,7 @@ async fn cursor_position_newly_opened_file() -> anyhow::Result<()> {
88 Ok(())
88 Ok(())
89}
89}
90
90
91−#[tokio::test]
91+#[tokio::test(flavor = "multi_thread")]
92async fn cursor_position_append_eof() -> anyhow::Result<()> {
92async fn cursor_position_append_eof() -> anyhow::Result<()> {
93 // Selection is fowards
93 // Selection is fowards
94 test((
94 test((
@@ -109,7 +109,7 @@ async fn cursor_position_append_eof() -> anyhow::Result<()> {
109 Ok(())
109 Ok(())
110}
110}
111
111
112−#[tokio::test]
112+#[tokio::test(flavor = "multi_thread")]
113async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> {
113async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> {
114 test_with_config(
114 test_with_config(
115 Args {
115 Args {
@@ -141,7 +141,7 @@ async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::
141 Ok(())
141 Ok(())
142}
142}
143
143
144−#[tokio::test]
144+#[tokio::test(flavor = "multi_thread")]
145async fn select_mode_tree_sitter_prev_function_unselects_object() -> anyhow::Result<()> {
145async fn select_mode_tree_sitter_prev_function_unselects_object() -> anyhow::Result<()> {
146 test_with_config(
146 test_with_config(
147 Args {
147 Args {
@@ -173,7 +173,7 @@ async fn select_mode_tree_sitter_prev_function_unselects_object() -> anyhow::Res
173 Ok(())
173 Ok(())
174}
174}
175
175
176−#[tokio::test]
176+#[tokio::test(flavor = "multi_thread")]
177async fn select_mode_tree_sitter_prev_function_goes_backwards_to_object() -> anyhow::Result<()> {
177async fn select_mode_tree_sitter_prev_function_goes_backwards_to_object() -> anyhow::Result<()> {
178 // Note: the anchor stays put and the head moves back.
178 // Note: the anchor stays put and the head moves back.
179 test_with_config(
179 test_with_config(
helix-term/tests/test/prompt.rs+1−1
@@ -1,6 +1,6 @@
1use super::*;
1use super::*;
2
2
3−#[tokio::test]
3+#[tokio::test(flavor = "multi_thread")]
4async fn test_history_completion() -> anyhow::Result<()> {
4async fn test_history_completion() -> anyhow::Result<()> {
5 test_key_sequence(
5 test_key_sequence(
6 &mut AppBuilder::new().build()?,
6 &mut AppBuilder::new().build()?,
helix-term/tests/test/write.rs+7−7
@@ -8,7 +8,7 @@ use helix_view::doc;
8
8
9use super::*;
9use super::*;
10
10
11−#[tokio::test]
11+#[tokio::test(flavor = "multi_thread")]
12async fn test_write() -> anyhow::Result<()> {
12async fn test_write() -> anyhow::Result<()> {
13 let mut file = tempfile::NamedTempFile::new()?;
13 let mut file = tempfile::NamedTempFile::new()?;
14 let mut app = helpers::AppBuilder::new()
14 let mut app = helpers::AppBuilder::new()
@@ -92,7 +92,7 @@ async fn test_write_concurrent() -> anyhow::Result<()> {
92 Ok(())
92 Ok(())
93}
93}
94
94
95−#[tokio::test]
95+#[tokio::test(flavor = "multi_thread")]
96async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
96async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
97 let file = helpers::new_readonly_tempfile()?;
97 let file = helpers::new_readonly_tempfile()?;
98 let mut app = helpers::AppBuilder::new()
98 let mut app = helpers::AppBuilder::new()
@@ -133,7 +133,7 @@ async fn test_write_fail_mod_flag() -> anyhow::Result<()> {
133 Ok(())
133 Ok(())
134}
134}
135
135
136−#[tokio::test]
136+#[tokio::test(flavor = "multi_thread")]
137async fn test_write_scratch_to_new_path() -> anyhow::Result<()> {
137async fn test_write_scratch_to_new_path() -> anyhow::Result<()> {
138 let mut file = tempfile::NamedTempFile::new()?;
138 let mut file = tempfile::NamedTempFile::new()?;
139
139
@@ -158,7 +158,7 @@ async fn test_write_scratch_to_new_path() -> anyhow::Result<()> {
158 Ok(())
158 Ok(())
159}
159}
160
160
161−#[tokio::test]
161+#[tokio::test(flavor = "multi_thread")]
162async fn test_write_scratch_no_path_fails() -> anyhow::Result<()> {
162async fn test_write_scratch_no_path_fails() -> anyhow::Result<()> {
163 helpers::test_key_sequence_with_input_text(
163 helpers::test_key_sequence_with_input_text(
164 None,
164 None,
@@ -179,7 +179,7 @@ async fn test_write_scratch_no_path_fails() -> anyhow::Result<()> {
179 Ok(())
179 Ok(())
180}
180}
181
181
182−#[tokio::test]
182+#[tokio::test(flavor = "multi_thread")]
183async fn test_write_auto_format_fails_still_writes() -> anyhow::Result<()> {
183async fn test_write_auto_format_fails_still_writes() -> anyhow::Result<()> {
184 let mut file = tempfile::Builder::new().suffix(".rs").tempfile()?;
184 let mut file = tempfile::Builder::new().suffix(".rs").tempfile()?;
185
185
@@ -203,7 +203,7 @@ async fn test_write_auto_format_fails_still_writes() -> anyhow::Result<()> {
203 Ok(())
203 Ok(())
204}
204}
205
205
206−#[tokio::test]
206+#[tokio::test(flavor = "multi_thread")]
207async fn test_write_new_path() -> anyhow::Result<()> {
207async fn test_write_new_path() -> anyhow::Result<()> {
208 let mut file1 = tempfile::NamedTempFile::new().unwrap();
208 let mut file1 = tempfile::NamedTempFile::new().unwrap();
209 let mut file2 = tempfile::NamedTempFile::new().unwrap();
209 let mut file2 = tempfile::NamedTempFile::new().unwrap();
@@ -249,7 +249,7 @@ async fn test_write_new_path() -> anyhow::Result<()> {
249 Ok(())
249 Ok(())
250}
250}
251
251
252−#[tokio::test]
252+#[tokio::test(flavor = "multi_thread")]
253async fn test_write_fail_new_path() -> anyhow::Result<()> {
253async fn test_write_fail_new_path() -> anyhow::Result<()> {
254 let file = helpers::new_readonly_tempfile()?;
254 let file = helpers::new_readonly_tempfile()?;
255
255