From 8077294e43be0ead8e524c937554a3646b38c1ac Mon Sep 17 00:00:00 2001 From: Noel Kwan <47273164+kwannoel@users.noreply.github.com> Date: Thu, 9 Jun 2022 17:31:03 +0800 Subject: [PATCH] fix: render empty strings (#47) * render empty strings Signed-off-by: Noel Kwan * Update changelog + package version Signed-off-by: Noel Kwan --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- src/main.rs | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9afaa0..345e2c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +## [0.5.0] - 2022-06-09 + +### Added + +- Print empty strings as "(empty)" + ## [0.4.0] - 2022-06-07 ### Added diff --git a/Cargo.toml b/Cargo.toml index 784de2d..6a944f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqllogictest" -version = "0.4.0" +version = "0.5.0" edition = "2021" description = "Sqllogictest parser and runner." license = "MIT OR Apache-2.0" diff --git a/src/main.rs b/src/main.rs index cea0c46..81d339c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -370,7 +370,13 @@ impl sqllogictest::AsyncDB for Postgres { write!(output, " ").unwrap(); } match row.get(i) { - Some(v) => write!(output, "{}", v).unwrap(), + Some(v) => { + if v.is_empty() { + write!(output, "(empty)").unwrap() + } else { + write!(output, "{}", v).unwrap() + } + } None => write!(output, "NULL").unwrap(), } }