Un use the assert_match
in the tests
This commit is contained in:
parent
8674a03bf0
commit
15c7b9bd04
2 changed files with 26 additions and 14 deletions
|
@ -304,7 +304,6 @@ pub fn build_query_command(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::assert_matches::assert_matches;
|
||||
|
||||
const OUTPUT_WITH_ALL_TAGS: &str =
|
||||
include_str!("../../tests/samples/cmus-remote-output-with-all-tags.txt");
|
||||
|
@ -329,7 +328,8 @@ mod tests {
|
|||
fn test_create_track_from_str() {
|
||||
let track = Track::from_str(OUTPUT_WITH_ALL_TAGS);
|
||||
|
||||
assert_matches!(track, Ok(_));
|
||||
// assert_matches!(track, Ok(_));
|
||||
assert!(track.is_ok());
|
||||
|
||||
let track = track.unwrap();
|
||||
|
||||
|
|
36
src/lib.rs
36
src/lib.rs
|
@ -1,5 +1,3 @@
|
|||
#![feature(assert_matches)]
|
||||
|
||||
use crate::cmus::{TemplateProcessor, Track};
|
||||
#[cfg(feature = "debug")]
|
||||
use log::{debug, info};
|
||||
|
@ -232,7 +230,6 @@ pub fn process_template_placeholders(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::cmus::player_settings::PlayerSettings;
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::str::FromStr;
|
||||
use test_context::{test_context, TestContext};
|
||||
|
||||
|
@ -277,9 +274,12 @@ mod tests {
|
|||
®ex::Regex::new(r"cover|.\.jpg|.\.png").unwrap(),
|
||||
);
|
||||
|
||||
assert_matches!(cover_path, Ok(Some(_)));
|
||||
// assert_matches!(cover_path, Ok(Some(_)));
|
||||
assert!(cover_path.is_ok());
|
||||
let cover_path = cover_path.unwrap();
|
||||
assert!(cover_path.is_some());
|
||||
assert_eq!(
|
||||
cover_path.unwrap().unwrap(),
|
||||
cover_path.unwrap(),
|
||||
"tests/samples/Owl City/Cinematic/cover/cover.jpg"
|
||||
);
|
||||
}
|
||||
|
@ -292,9 +292,12 @@ mod tests {
|
|||
®ex::Regex::new(r".\.jpg|.\.png").unwrap(),
|
||||
);
|
||||
|
||||
assert_matches!(cover_path, Ok(Some(_)));
|
||||
// assert_matches!(cover_path, Ok(Some(_)));
|
||||
assert!(cover_path.is_ok());
|
||||
let cover_path = cover_path.unwrap();
|
||||
assert!(cover_path.is_some());
|
||||
assert_eq!(
|
||||
cover_path.unwrap().unwrap(),
|
||||
cover_path.unwrap(),
|
||||
"tests/samples/Owl City/Cinematic/cover/cover.jpg"
|
||||
);
|
||||
}
|
||||
|
@ -307,9 +310,12 @@ mod tests {
|
|||
®ex::Regex::new(r".\.png").unwrap(),
|
||||
);
|
||||
|
||||
assert_matches!(cover_path, Ok(Some(_)));
|
||||
// assert_matches!(cover_path, Ok(Some(_)));
|
||||
assert!(cover_path.is_ok());
|
||||
let cover_path = cover_path.unwrap();
|
||||
assert!(cover_path.is_some());
|
||||
assert_eq!(
|
||||
cover_path.unwrap().unwrap(),
|
||||
cover_path.unwrap(),
|
||||
"tests/samples/Owl City/Cinematic/cover/cover.png"
|
||||
);
|
||||
}
|
||||
|
@ -322,9 +328,12 @@ mod tests {
|
|||
®ex::Regex::new(r".\.lrc").unwrap(),
|
||||
);
|
||||
|
||||
assert_matches!(lrc_path, Ok(Some(_)));
|
||||
// assert_matches!(lrc_path, Ok(Some(_)));
|
||||
assert!(lrc_path.is_ok());
|
||||
let lrc_path = lrc_path.unwrap();
|
||||
assert!(lrc_path.is_some());
|
||||
assert_eq!(
|
||||
lrc_path.unwrap().unwrap(),
|
||||
lrc_path.unwrap(),
|
||||
"tests/samples/Owl City/Cinematic/08 - Always.lrc"
|
||||
);
|
||||
}
|
||||
|
@ -337,6 +346,9 @@ mod tests {
|
|||
®ex::Regex::new(r".\.mp3").unwrap(),
|
||||
);
|
||||
|
||||
assert_matches!(result, Ok(None));
|
||||
// assert_matches!(result, Ok(None));
|
||||
assert!(result.is_ok());
|
||||
let result = result.unwrap();
|
||||
assert!(result.is_none());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue