rusty-diceware

Commandline diceware, with or without dice, written in Rustlang.
git clone https://kaka.farm/~git/rusty-diceware
Log | Files | Refs | README | LICENSE

commit 06c40bbef1348c02709efdea6c53c4c30255baf9
parent e84cda1b38cdcef2cad084bef0b350d0c201e65d
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Thu,  7 Nov 2024 06:49:12 +0200

Improve tests.

Diffstat:
Msrc/main.rs | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -340,7 +340,10 @@ mod tests { let wordlist = Wordlist::default().get_list().to_vec(); let input = &b"11111\n"[..]; let mut reader = BufReader::with_capacity(input.len(), input).bytes(); - assert_eq!("abacus", read_single_word(&mut reader, &wordlist).unwrap()); + assert_eq!( + Some("abacus".to_string()), + read_single_word(&mut reader, &wordlist) + ); } #[test] @@ -349,8 +352,9 @@ mod tests { let input = &b"11111\n66665\n"[..]; let mut reader = BufReader::with_capacity(input.len(), input).bytes(); let mut words_iter = ReadWordDieCasts::new(&mut reader, &wordlist); - assert_eq!("abacus", words_iter.next().unwrap()); - assert_eq!("zoology", words_iter.next().unwrap()); + assert_eq!(Some("abacus".to_string()), words_iter.next()); + assert_eq!(Some("zoology".to_string()), words_iter.next()); + assert_eq!(None, words_iter.next()); } // #[test]