aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2022-03-13 01:48:59 +0100
committerTeddy Wing2022-03-13 01:54:17 +0100
commit306dec4c599736ecffef321fc419e3fa7bec77a3 (patch)
tree106d1e03ed927d02ebb0b51bce2cacb7cc29cc04 /src
parent336d2d0246407b596760fdb9e5c2a9bc46c8f29a (diff)
downloadyaqlite-306dec4c599736ecffef321fc419e3fa7bec77a3.tar.bz2
insert(): Add a test for nonexistent column handling
Check that nonexistent columns are ignored from the input YAML.
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs20
1 files changed, 20 insertions, 0 deletions
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]