From 7f6c3a715d4a8267c5804c082b2aaa5980795f09 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Fri, 2 Dec 2022 00:57:46 +0100 Subject: [PATCH] fix: also handle "type" for data type --- src/rust/data/mariadb_test_case_13.html | 19 ++++++++++++++++++ src/rust/mariadb.rs | 26 ++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/rust/data/mariadb_test_case_13.html diff --git a/src/rust/data/mariadb_test_case_13.html b/src/rust/data/mariadb_test_case_13.html new file mode 100644 index 00000000..aedba043 --- /dev/null +++ b/src/rust/data/mariadb_test_case_13.html @@ -0,0 +1,19 @@ +

system_versioning_insert_history

+ diff --git a/src/rust/mariadb.rs b/src/rust/mariadb.rs index 66e281a7..55ae0954 100644 --- a/src/rust/mariadb.rs +++ b/src/rust/mariadb.rs @@ -173,7 +173,7 @@ fn process_li(mut entry: KbParsedEntry, li_node: Node) -> KbParsedEntry { "dynamic" => { entry.dynamic = Some(row_value.to_lowercase() == "yes"); } - "data type" => { + "data type" | "type" => { entry.r#type = Some(row_value.to_lowercase().trim().to_string()); if entry.r#type != Some("".to_string()) { @@ -868,4 +868,28 @@ mod tests { entries ); } + + #[test] + fn test_case_13() { + let entries = extract_mariadb_from_text(QueryResponse { + body: get_test_data("mariadb_test_case_13.html"), + url: "https://example.com", + }); + + assert_eq!( + vec![KbParsedEntry { + has_description: true, + cli: Some("--system-versioning-insert-history[={0|1}]".to_string()), + default: Some("OFF".to_string()), + dynamic: Some(true), + id: "system_versioning_insert_history".to_string(), + name: Some("system_versioning_insert_history".to_string()), + scope: Some(vec!["global".to_string(), "session".to_string()]), + r#type: Some("boolean".to_string()), + valid_values: None, + range: None, + },], + entries + ); + } }