From 3be1bf4384d6f02211bac1d22c2006c2feea26f5 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 2 Jul 2024 23:28:23 +0200 Subject: [PATCH] Added test and updated releasenotes for formatter changes. --- releasenotes.md | 1 + test/unit/stdlib/core/string.c3 | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/releasenotes.md b/releasenotes.md index 5ede7316e..2f2ce5b7d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -35,6 +35,7 @@ - Added @str_hash, @str_upper, @str_lower, @str_find compile time macros. - Remove "panic" text from unreachable() when safe mode is turned off. - Added `@unaligned_store` and `@unaligned_load`. +- Null ZString, DString or pointer prints "(null)" for printf. ## 0.6.0 Change list diff --git a/test/unit/stdlib/core/string.c3 b/test/unit/stdlib/core/string.c3 index 51aa80888..045bd87cd 100644 --- a/test/unit/stdlib/core/string.c3 +++ b/test/unit/stdlib/core/string.c3 @@ -12,6 +12,16 @@ fn void test_starts_with() assert(!s.starts_with("o")); } +fn void test_print_null() +{ + ZString z; + int* y; + ZString w = "hello"; + String s = string::new_format("%s %s %s", z, w, y); + defer free(s); + assert(s == "(null) hello (null)"); +} + fn void test_strip() { String s = "ofke";