test(desktop): stop splitting generated passphrases on a hyphen

The EFF short wordlist 2.0 contains the word "yo-yo". The
word-count assertion in
generated_passphrase_respects_word_count_and_separator split the
generated phrase on "-", so any draw containing "yo-yo" produced one
extra part and failed the count assertion (~0.5% of runs — bit
Desktop Core on run 31915536337). The sibling clamps test already
documents this trap and uses "|"; do the same here.

Co-authored-by: Thomas Petersen <thomasp@squareup.com>
Signed-off-by: Thomas Petersen <thomasp@squareup.com>
This commit is contained in:
Wintermute
2026-08-15 20:16:03 -04:00
co-authored by Thomas Petersen
parent 78cbffeb64
commit c239b741d2
+5 -1
View File
@@ -233,7 +233,11 @@ fn generated_passphrase_respects_word_count_and_separator() {
WORDLIST.lines().filter(|l| !l.is_empty()).collect();
assert_eq!(words.len(), 1296, "EFF short wordlist 2.0 has 1296 words");
for (count, separator) in [(3, "-"), (4, "-"), (6, " "), (5, "."), (10, "")] {
// "-" is deliberately absent: the wordlist contains "yo-yo", so splitting
// a phrase on "-" yields an extra part whenever that word is drawn (a
// ~0.5% flake per run). `generated_passphrase_clamps_word_count` below
// documents the same trap; the join logic itself is separator-agnostic.
for (count, separator) in [(3, "|"), (4, "|"), (6, " "), (5, "."), (10, "")] {
let phrase = generate_passphrase(count, separator).unwrap();
if separator.is_empty() {
// No separator to split on; length gate below still applies.