From 89fc563f009307193b281b9058d689d9ebf1c7d7 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 29 Apr 2024 10:56:18 -0400 Subject: [PATCH] xo-indentlog: utest: track gcc behavior change around 13.2 --- include/xo/indentlog/print/quoted.hpp | 2 +- utest/quoted.test.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/xo/indentlog/print/quoted.hpp b/include/xo/indentlog/print/quoted.hpp index 5b7621f4..4cc19594 100644 --- a/include/xo/indentlog/print/quoted.hpp +++ b/include/xo/indentlog/print/quoted.hpp @@ -97,7 +97,7 @@ namespace xo { private: /* .unq_flag: if true, omit surrounding " chars - * if printed value satisfies both: + * whenever printed value satisfies both: * - no escaped chars * - no spaces */ diff --git a/utest/quoted.test.cpp b/utest/quoted.test.cpp index 32e641bb..9f65ea33 100644 --- a/utest/quoted.test.cpp +++ b/utest/quoted.test.cpp @@ -45,7 +45,7 @@ namespace ut { quoted_tcase("two words", false, "\"two words\""), quoted_tcase("1st\n2nd", true, "\"1st\\n2nd\""), -#if __GNUC__ >= 13 && __GNUC_MINOR_ >= 2 +#if __GNUC__ >= 13 && __GNUC_MINOR__ >= 2 /* writes "1st\\nsecond", but still gets turned into newline somewhere. only on very recent gcc. (not on 11.4.0) */ quoted_tcase("1st\n2nd", false, "\"1st\n2nd\""), #else @@ -53,7 +53,7 @@ namespace ut { #endif quoted_tcase("misakte\rfix", true, "\"misakte\\rfix\""), -#if __GNUC__ >= 13 && __GNUC_MINOR >= 2 +#if __GNUC__ >= 13 && __GNUC_MINOR__ >= 2 quoted_tcase("misakte\rfix", false, "\"misakte\rfix\""), #else quoted_tcase("misakte\rfix", false, "\"misakte\\rfix\""), @@ -63,7 +63,11 @@ namespace ut { quoted_tcase("\"oh!\", she said", false, "\"\\\"oh!\\\", she said\""), quoted_tcase("", true, ""), +#if __GNUC__ >= 13 && __GNUC_MINOR__ >= 2 quoted_tcase("", false, "\"\""), +#else + quoted_tcase("", false, "\"\""), +#endif }); TEST_CASE("quoted", "[quoted]") { @@ -93,6 +97,7 @@ namespace ut { INFO(tostr("[", tc.s_, "]")); INFO("tc.s ----------------"); INFO("ss.str ----------------"); + INFO(tostr("[", ss.view(), "]")); INFO(tostr("[", ss.str(), "]")); INFO("ss.str ----------------");