From 68970417723d96f586778b9d925303b7a539ec9e Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Mon, 31 Oct 2022 23:01:58 -0400 Subject: [PATCH] Fix failing tests from tag rework --- .../lang/vocabulary/filters/field_filter.rs | 2 +- interpreter/src/music/tag.rs | 2 +- interpreter/tests/single_line.rs | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/interpreter/src/lang/vocabulary/filters/field_filter.rs b/interpreter/src/lang/vocabulary/filters/field_filter.rs index fdb812f..a49c92b 100644 --- a/interpreter/src/lang/vocabulary/filters/field_filter.rs +++ b/interpreter/src/lang/vocabulary/filters/field_filter.rs @@ -77,7 +77,7 @@ impl FilterPredicate for FieldFilter { } else { match self.field_errors { FieldFilterErrorHandling::Error => Err(RuntimeMsg(format!( - "Field {} does not exist", + "Field {} does not exist on item", &self.field_name ))), FieldFilterErrorHandling::Ignore => Ok(false), diff --git a/interpreter/src/music/tag.rs b/interpreter/src/music/tag.rs index 1897c44..b12c682 100644 --- a/interpreter/src/music/tag.rs +++ b/interpreter/src/music/tag.rs @@ -421,7 +421,7 @@ impl TagType { Self::Flag => None, Self::I64(i) => Some(crate::lang::TypePrimitive::Int(i)), 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, } } diff --git a/interpreter/tests/single_line.rs b/interpreter/tests/single_line.rs index fe4d0cb..fda6a07 100644 --- a/interpreter/tests/single_line.rs +++ b/interpreter/tests/single_line.rs @@ -175,22 +175,22 @@ fn execute_emptyfilter_line() -> Result<(), InterpreterError> { #[test] fn execute_fieldfilter_line() -> Result<(), InterpreterError> { execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year >= 2000)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date >= 2000)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year <= 2020)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date <= 2020)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year == 2016)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date == 2016)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year != 2048)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date != 2048)", false, true, ) @@ -199,22 +199,22 @@ fn execute_fieldfilter_line() -> Result<(), InterpreterError> { #[test] fn execute_fieldfiltermaybe_line() -> Result<(), InterpreterError> { execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year? >= 2000)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date? >= 2000)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year? <= 2020)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date? <= 2020)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year! == 2016)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date! == 2016)", false, true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year! != `test`)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date! != `test`)", false, true, ) @@ -232,7 +232,7 @@ fn execute_files_line() -> Result<(), InterpreterError> { false, true, )?; - execute_single_line(r"files()", false, true) + execute_single_line(r"files().(??)", false, true) } #[test] @@ -291,12 +291,12 @@ fn execute_orfilter_line() -> Result<(), InterpreterError> { true, )?; execute_single_line( - "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(year != 2020 || 5)", + "files(`~/Music/MusicFlac/Bruno Mars/24K Magic/`).(date != 2020 || 5)", false, true, )?; 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, true, )