Resolve "Local collection trait and beets implementation" #9
@ -87,7 +87,7 @@ impl Beets {
|
||||
trait LibraryPrivate {
|
||||
const CMD_LIST: &'static str;
|
||||
const LIST_FORMAT_SEPARATOR: &'static str;
|
||||
const LIST_FORMAT: &'static str;
|
||||
const LIST_FORMAT_ARG: &'static str;
|
||||
|
||||
fn list_cmd_and_args(query: &Query) -> Vec<String>;
|
||||
fn list_to_albums(list_output: Vec<String>) -> Result<Vec<Album>, Error>;
|
||||
@ -110,7 +110,7 @@ macro_rules! list_format_separator {
|
||||
impl LibraryPrivate for Beets {
|
||||
const CMD_LIST: &'static str = "ls";
|
||||
const LIST_FORMAT_SEPARATOR: &'static str = list_format_separator!();
|
||||
const LIST_FORMAT: &'static str = concat!(
|
||||
const LIST_FORMAT_ARG: &'static str = concat!(
|
||||
"--format=",
|
||||
"$albumartist",
|
||||
list_format_separator!(),
|
||||
@ -127,7 +127,7 @@ impl LibraryPrivate for Beets {
|
||||
|
||||
fn list_cmd_and_args(query: &Query) -> Vec<String> {
|
||||
let mut cmd: Vec<String> = vec![String::from(Self::CMD_LIST)];
|
||||
cmd.push(Self::LIST_FORMAT.to_string());
|
||||
cmd.push(Self::LIST_FORMAT_ARG.to_string());
|
||||
cmd.append(&mut query.to_args());
|
||||
cmd
|
||||
}
|
||||
@ -315,7 +315,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_list_empty() {
|
||||
let executor = TestExecutor {
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT.to_string()]),
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT_ARG.to_string()]),
|
||||
output: Some(Ok(vec![])),
|
||||
};
|
||||
let mut beets = Beets::new(Box::new(executor));
|
||||
@ -334,7 +334,7 @@ mod tests {
|
||||
}
|
||||
|
||||
let executor = TestExecutor {
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT.to_string()]),
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT_ARG.to_string()]),
|
||||
output: Some(Ok(output)),
|
||||
};
|
||||
let mut beets = Beets::new(Box::new(executor));
|
||||
@ -363,7 +363,7 @@ mod tests {
|
||||
expected[1].tracks.rotate_left(1);
|
||||
|
||||
let executor = TestExecutor {
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT.to_string()]),
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT_ARG.to_string()]),
|
||||
output: Some(Ok(output)),
|
||||
};
|
||||
let mut beets = Beets::new(Box::new(executor));
|
||||
@ -384,7 +384,7 @@ mod tests {
|
||||
}
|
||||
|
||||
let executor = TestExecutor {
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT.to_string()]),
|
||||
arguments: Some(vec!["ls".to_string(), Beets::LIST_FORMAT_ARG.to_string()]),
|
||||
output: Some(Ok(output)),
|
||||
};
|
||||
let mut beets = Beets::new(Box::new(executor));
|
||||
@ -403,7 +403,7 @@ mod tests {
|
||||
let executor = TestExecutor {
|
||||
arguments: Some(vec![
|
||||
"ls".to_string(),
|
||||
Beets::LIST_FORMAT.to_string(),
|
||||
Beets::LIST_FORMAT_ARG.to_string(),
|
||||
String::from("^album:some.album"),
|
||||
String::from("track:5"),
|
||||
String::from("artist:some.artist"),
|
||||
|
Loading…
Reference in New Issue
Block a user