Create a unit test for parsing a shuffle mode from string

This commit is contained in:
Anas Elgarhy 2023-02-12 04:30:26 +02:00
parent 6856fe947a
commit 5a1e37c3c2
No known key found for this signature in database
GPG key ID: 0501802A1D496528

View file

@ -109,6 +109,19 @@ mod tests {
assert_eq!(unknown, Err(CmusError::UnknownAAAMode("unknown".to_string()))); assert_eq!(unknown, Err(CmusError::UnknownAAAMode("unknown".to_string())));
} }
#[test]
fn test_parse_shuffle_mode_from_str() {
let off = Shuffle::from_str("off");
let tracks = Shuffle::from_str("tracks");
let albums = Shuffle::from_str("albums");
let unknown = Shuffle::from_str("unknown");
assert_eq!(off, Ok(Shuffle::Off));
assert_eq!(tracks, Ok(Shuffle::Tracks));
assert_eq!(albums, Ok(Shuffle::Albums));
assert_eq!(unknown, Err(CmusError::UnknownShuffleMode("unknown".to_string())));
}
#[test] #[test]
fn test_parse_player_settings_from_str() { fn test_parse_player_settings_from_str() {