aboutsummaryrefslogtreecommitdiffstats
path: root/src/insert.rs
diff options
context:
space:
mode:
authorTeddy Wing2022-04-05 19:53:20 +0200
committerTeddy Wing2022-04-05 19:53:20 +0200
commit5f8b19f73b1a506cdcc4a33113a10c470927d09d (patch)
tree07fedac476590ac6d40c47770717e4b1da9c849d /src/insert.rs
parentbc0afe2353f925124c67bf5785813432de44af57 (diff)
downloadyaqlite-5f8b19f73b1a506cdcc4a33113a10c470927d09d.tar.bz2
insert(): Add a test with YAML keys referring to nonexistent columnsupdate
Diffstat (limited to 'src/insert.rs')
-rw-r--r--src/insert.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/insert.rs b/src/insert.rs
index 59c8850..0c9f45e 100644
--- a/src/insert.rs
+++ b/src/insert.rs
@@ -205,4 +205,28 @@ weight: {}
test_yaml_insert(&yaml_str, &vec![expected]);
}
+
+ #[test]
+ fn insert_ignores_non_column_yaml_fields() {
+ let expected = TestRecord {
+ id: 1,
+ count: 102,
+ weight: 79.4,
+ description: "Some text content.".to_owned(),
+ };
+
+ let yaml_str = format!(
+r#"description: {}
+count: {}
+weight: {}
+key_is_not_a_column: 44
+not-a-column: Text that shouldn't be inserted.
+"#,
+ expected.description,
+ expected.count,
+ expected.weight,
+ );
+
+ test_yaml_insert(&yaml_str, &vec![expected]);
+ }
}