From de7c2af3414cf686165efd933b61da4e4527cf77 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 13 Mar 2022 01:55:25 +0100 Subject: insert(): Add test for non-array YAML hash Test that a plain YAML hash gets inserted even when not wrapped in an array. --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 5ee5b8e..f8d0032 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -139,5 +139,23 @@ r#"- description: >- #[test] fn inserts_yaml_hash() { + let expected = TestRecord { + id: 1, + count: 255, + weight: 86.6, + description: "Some text content.".to_owned(), + }; + + let yaml_str = format!( +r#"description: {} +count: {} +weight: {} +"#, + expected.description, + expected.count, + expected.weight, + ); + + test_yaml_insert(&yaml_str, &vec![expected]); } } -- cgit v1.2.3