diff --git a/sqllogictest-bin/src/main.rs b/sqllogictest-bin/src/main.rs index af9d610..4ddf225 100644 --- a/sqllogictest-bin/src/main.rs +++ b/sqllogictest-bin/src/main.rs @@ -16,7 +16,10 @@ use itertools::Itertools; use quick_junit::{NonSuccessKind, Report, TestCase, TestCaseStatus, TestSuite}; use rand::distributions::DistString; use rand::seq::SliceRandom; -use sqllogictest::{default_column_validator, default_normalizer, default_validator, update_record_with_output, AsyncDB, Injected, MakeConnection, Record, Runner}; +use sqllogictest::{ + default_column_validator, default_normalizer, default_validator, update_record_with_output, + AsyncDB, Injected, MakeConnection, Record, Runner, +}; #[derive(Default, Copy, Clone, Debug, PartialEq, Eq, ValueEnum)] #[must_use] diff --git a/sqllogictest/src/parser.rs b/sqllogictest/src/parser.rs index e13d6e0..5924af6 100644 --- a/sqllogictest/src/parser.rs +++ b/sqllogictest/src/parser.rs @@ -850,8 +850,10 @@ fn parse_inner(loc: &Location, script: &str) -> Result match res { - ["resultmode", result_mode] => match ResultMode::try_from_str(result_mode) { - Ok(result_mode) => records.push(Record::Control(Control::ResultMode(result_mode))), + ["resultmode", result_mode] => match ResultMode::try_from_str(result_mode) { + Ok(result_mode) => { + records.push(Record::Control(Control::ResultMode(result_mode))) + } Err(k) => return Err(k.at(loc)), }, ["sortmode", sort_mode] => match SortMode::try_from_str(sort_mode) { @@ -871,7 +873,7 @@ fn parse_inner(loc: &Location, script: &str) -> Result return Err(ParseErrorKind::InvalidLine(line.into()).at(loc)), } } diff --git a/sqllogictest/src/runner.rs b/sqllogictest/src/runner.rs index 1cb859e..792dd2a 100644 --- a/sqllogictest/src/runner.rs +++ b/sqllogictest/src/runner.rs @@ -467,9 +467,14 @@ pub fn default_normalizer(s: &String) -> String { /// # Default /// /// By default, the ([`default_validator`]) will be used compare normalized results. -pub type Validator = fn(normalizer: Normalizer, actual: &[Vec], expected: &[String]) -> bool; +pub type Validator = + fn(normalizer: Normalizer, actual: &[Vec], expected: &[String]) -> bool; -pub fn default_validator(normalizer: Normalizer, actual: &[Vec], expected: &[String]) -> bool { +pub fn default_validator( + normalizer: Normalizer, + actual: &[Vec], + expected: &[String], +) -> bool { let expected_results = expected.iter().map(normalizer).collect_vec(); // Default, we compare normalized results. Whitespace characters are ignored. let normalized_rows = actual @@ -1032,11 +1037,11 @@ impl> Runner { } let actual_results = match self.result_mode { - Some(ResultMode::ValueWise) => - rows.into_iter() - .flat_map(|strs| strs.into_iter()) - .map(|str| vec![str.to_string()]) - .collect_vec(), + Some(ResultMode::ValueWise) => rows + .into_iter() + .flat_map(|strs| strs.into_iter()) + .map(|str| vec![str.to_string()]) + .collect_vec(), // default to rowwise _ => rows.clone(), }; @@ -1591,7 +1596,10 @@ pub fn update_record_with_output( connection, expected: match expected { QueryExpect::Results { - sort_mode, label, result_mode, .. + sort_mode, + label, + result_mode, + .. } => QueryExpect::Results { results, types,