From cf9eecd26b0fcaf8d3e0b1fab412c1ed894fe585 Mon Sep 17 00:00:00 2001 From: Flavian Desverne Date: Tue, 23 Apr 2024 11:39:27 +0200 Subject: [PATCH] chore: add tests for zero-length encoding of varlen columns --- src/tds/codec/column_data.rs | 5 ++++- tests/bulk.rs | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tds/codec/column_data.rs b/src/tds/codec/column_data.rs index 97602ceb..6df30173 100644 --- a/src/tds/codec/column_data.rs +++ b/src/tds/codec/column_data.rs @@ -722,7 +722,10 @@ mod tests { assert_eq!(nd, d); - reader.read_u8().await.expect_err("decode must consume entire buffer"); + reader + .read_u8() + .await + .expect_err("decode must consume entire buffer"); } #[tokio::test] diff --git a/tests/bulk.rs b/tests/bulk.rs index fdf059d9..2e12a38a 100644 --- a/tests/bulk.rs +++ b/tests/bulk.rs @@ -112,6 +112,10 @@ test_bulk_type!(smallint("SMALLINT", 2000, 0..2000i16)); test_bulk_type!(int("INT", 2000, 0..2000i32)); test_bulk_type!(bigint("BIGINT", 2000, 0..2000i64)); +test_bulk_type!(empty_varchar("VARCHAR(MAX)", 1, [""].into_iter())); +test_bulk_type!(empty_nvarchar("NVARCHAR(MAX)", 1, [""].into_iter())); +test_bulk_type!(empty_varbinary("VARBINARY(MAX)", 1, [b""].into_iter())); + test_bulk_type!(real( "REAL", 1000,