From cdddf24f2503c8b069a72c4d004ebfa80e8fe041 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 19 Jun 2020 14:54:41 -0600 Subject: [PATCH] add hintfmt test --- src/libutil/tests/logging.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libutil/tests/logging.cc b/src/libutil/tests/logging.cc index 4cb54995b..b24975438 100644 --- a/src/libutil/tests/logging.cc +++ b/src/libutil/tests/logging.cc @@ -1,6 +1,7 @@ #include "logging.hh" #include "nixexpr.hh" #include "util.hh" +#include #include @@ -252,4 +253,21 @@ namespace nix { ASSERT_STREQ(str.c_str(), "\x1B[33;1mwarning:\x1B[0m\x1B[34;1m --- warning name --- error-unit-test\x1B[0m\nin file: \x1B[34;1mmyfile.nix (40:13)\x1B[0m\n\nwarning description\n\n 40| this is the problem line of code\n | \x1B[31;1m^\x1B[0m\n\nthis hint has \x1B[33;1myellow\x1B[0m templated \x1B[33;1mvalues\x1B[0m!!\n"); } + /* ---------------------------------------------------------------------------- + * hintfmt + * --------------------------------------------------------------------------*/ + + TEST(hintfmt, withstandsPercentString) { + + const char *teststr = "this is 100%s correct!"; + auto hint = hintfmt(teststr); + + std::ofstream meh("meh.txt"); + meh << hint.str() << std::endl; + + ASSERT_STREQ(hint.str().c_str(), teststr); + } + + + }