From 172c935fca54e5791777d3ad68bf23b796e1c8e0 Mon Sep 17 00:00:00 2001 From: VoiceLessQ Date: Sat, 24 Oct 2026 19:48:47 -0100 Subject: [PATCH] Proof tests: the user-dictionary file test waits for the dictionary tests user_dictionary_persists_through_a_file saves the whole user dictionary to a file and loads it back. Run beside user_dictionary_and_ignore_all_match_both_normalization_forms, it could catch a word that test had added and bring it back after the test removed it, so the other test's last check failed now and then (once in about two dozen full runs here). It now holds DICTIONARY_TESTS, as the other test does. --- crates/proof/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/proof/src/lib.rs b/crates/proof/src/lib.rs index 7469c4d9..ad516b29 100644 --- a/crates/proof/src/lib.rs +++ b/crates/proof/src/lib.rs @@ -1059,7 +1059,9 @@ mod tests { use super::*; - /// Held by tests that swap or rely on the shared Spanish dictionary, so a folder reset can't land mid-test. + /// Held by tests that swap or rely on the shared Spanish dictionary, so a folder reset can't land + /// mid-test, and by those that save the whole user dictionary and load it back, which would + /// bring back a word another test just removed. static DICTIONARY_TESTS: std::sync::Mutex<()> = std::sync::Mutex::new(()); /// #1063: the dictionaries folder is searched before the system locations; the dictionaries @@ -1579,6 +1581,7 @@ mod tests { /// #40: the user dictionary survives a save and a fresh load. #[test] fn user_dictionary_persists_through_a_file() { + let _guard = DICTIONARY_TESTS.lock().unwrap_or_else(std::sync::PoisonError::into_inner); let dir = std::env::temp_dir().join(format!("wc-dict-{}-{}", std::process::id(), "persist")); let _ = std::fs::remove_dir_all(&dir); // The folder is created on the first save.