diff options
| author | Teddy Wing | 2022-03-13 01:58:19 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2022-03-13 01:58:19 +0100 | 
| commit | d2b6b8e5f3e54483f269e501816b9e275d59223f (patch) | |
| tree | a4055171c8b6e3115594e4c3c72d695c77cfbd77 /src | |
| parent | de7c2af3414cf686165efd933b61da4e4527cf77 (diff) | |
| download | yaqlite-d2b6b8e5f3e54483f269e501816b9e275d59223f.tar.bz2 | |
insert(): Test that an array of YAML records get inserted
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 35 | 
1 files changed, 33 insertions, 2 deletions
| @@ -54,8 +54,7 @@ mod tests {              let mut stmt = conn.prepare(r#"                  SELECT                      id, count, weight, description -                FROM "test" -                LIMIT 1; +                FROM "test";              "#).unwrap();              let rows = stmt.query_map( @@ -135,6 +134,38 @@ r#"- description: >-      #[test]      fn inserts_multiple_records() { +        let expected = vec![ +            TestRecord { +                id: 1, +                count: 10, +                weight: 33.2, +                description: "First".to_owned(), +            }, +            TestRecord { +                id: 2, +                count: 12, +                weight: 180.5, +                description: "Second".to_owned(), +            }, +        ]; + +        let yaml_str = format!( +r#"- description: {} +  count: {} +  weight: {} +- description: {} +  count: {} +  weight: {} +"#, +            expected[0].description, +            expected[0].count, +            expected[0].weight, +            expected[1].description, +            expected[1].count, +            expected[1].weight, +        ); + +        test_yaml_insert(&yaml_str, &expected);      }      #[test] | 
