File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,12 +211,16 @@ fn generated_passphrase_respects_word_count_and_separator() {
211211
212212#[ test]
213213fn generated_passphrase_clamps_word_count ( ) {
214+ // Use a separator that cannot appear in the EFF wordlist so a generated
215+ // word such as "yo-yo" cannot be mistaken for two words.
216+ const SEPARATOR : & str = "|" ;
217+
214218 // Below the floor: clamped up to MIN_PASSPHRASE_WORDS, never shorter.
215- let phrase = generate_passphrase ( 1 , "-" ) . unwrap ( ) ;
216- assert_eq ! ( phrase. split( '-' ) . count( ) , MIN_PASSPHRASE_WORDS ) ;
219+ let phrase = generate_passphrase ( 1 , SEPARATOR ) . unwrap ( ) ;
220+ assert_eq ! ( phrase. split( SEPARATOR ) . count( ) , MIN_PASSPHRASE_WORDS ) ;
217221 // Above the ceiling: clamped down to MAX_PASSPHRASE_WORDS.
218- let phrase = generate_passphrase ( 50 , "-" ) . unwrap ( ) ;
219- assert_eq ! ( phrase. split( '-' ) . count( ) , MAX_PASSPHRASE_WORDS ) ;
222+ let phrase = generate_passphrase ( 50 , SEPARATOR ) . unwrap ( ) ;
223+ assert_eq ! ( phrase. split( SEPARATOR ) . count( ) , MAX_PASSPHRASE_WORDS ) ;
220224}
221225
222226#[ test]
You can’t perform that action at this time.
0 commit comments