Fix failing tests from tag rework

This commit is contained in:
NGnius (Graham) 2022-10-31 23:01:58 -04:00
parent 15c42e6654
commit 6897041772
3 changed files with 13 additions and 13 deletions

View file

@ -77,7 +77,7 @@ impl FilterPredicate for FieldFilter {
} else { } else {
match self.field_errors { match self.field_errors {
FieldFilterErrorHandling::Error => Err(RuntimeMsg(format!( FieldFilterErrorHandling::Error => Err(RuntimeMsg(format!(
"Field {} does not exist", "Field {} does not exist on item",
&self.field_name &self.field_name
))), ))),
FieldFilterErrorHandling::Ignore => Ok(false), FieldFilterErrorHandling::Ignore => Ok(false),

View file

@ -421,7 +421,7 @@ impl TagType {
Self::Flag => None, Self::Flag => None,
Self::I64(i) => Some(crate::lang::TypePrimitive::Int(i)), Self::I64(i) => Some(crate::lang::TypePrimitive::Int(i)),
Self::U64(u) => Some(crate::lang::TypePrimitive::UInt(u)), Self::U64(u) => Some(crate::lang::TypePrimitive::UInt(u)),
Self::Str(s) => Some(crate::lang::TypePrimitive::String(s.clone())), Self::Str(s) => Some(crate::lang::TypePrimitive::parse(s.clone())),
Self::Unknown => None, Self::Unknown => None,
} }
} }

View file

@ -175,22 +175,22 @@ fn execute_emptyfilter_line() -> Result<(), InterpreterError> {
#[test] #[test]
fn execute_fieldfilter_line() -> Result<(), InterpreterError> { fn execute_fieldfilter_line() -> Result<(), InterpreterError> {
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year >= 2000)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date >= 2000)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year <= 2020)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date <= 2020)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year == 2016)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date == 2016)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year != 2048)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date != 2048)",
false, false,
true, true,
) )
@ -199,22 +199,22 @@ fn execute_fieldfilter_line() -> Result<(), InterpreterError> {
#[test] #[test]
fn execute_fieldfiltermaybe_line() -> Result<(), InterpreterError> { fn execute_fieldfiltermaybe_line() -> Result<(), InterpreterError> {
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year? >= 2000)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date? >= 2000)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year? <= 2020)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date? <= 2020)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year! == 2016)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date! == 2016)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year! != `test`)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date! != `test`)",
false, false,
true, true,
) )
@ -232,7 +232,7 @@ fn execute_files_line() -> Result<(), InterpreterError> {
false, false,
true, true,
)?; )?;
execute_single_line(r"files()", false, true) execute_single_line(r"files().(??)", false, true)
} }
#[test] #[test]
@ -291,12 +291,12 @@ fn execute_orfilter_line() -> Result<(), InterpreterError> {
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year != 2020 || 5)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date != 2020 || 5)",
false, false,
true, true,
)?; )?;
execute_single_line( execute_single_line(
"files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year != 2020 || 5 || 4 || 12)", "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date != 2020 || 5 || 4 || 12)",
false, false,
true, true,
) )