From 306dec4c599736ecffef321fc419e3fa7bec77a3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 13 Mar 2022 01:48:59 +0100 Subject: insert(): Add a test for nonexistent column handling Check that nonexistent columns are ignored from the input YAML. --- src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index b39eeaf..5ee5b8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -111,6 +111,26 @@ r#"- description: >- #[test] fn ignores_yaml_fields_that_are_not_column_names() { + let expected = TestRecord { + id: 1, + count: 55, + weight: 7.65, + description: "Some text content.".to_owned(), + }; + + let yaml_str = format!( +r#"- description: >- + {} + count: {} + weight: {} + nonexistent_column: Must not be inserted. +"#, + expected.description, + expected.count, + expected.weight, + ); + + test_yaml_insert(&yaml_str, &vec![expected]); } #[test] -- cgit v1.2.3