diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-06-19 14:54:41 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-06-19 14:54:41 -0600 |
commit | cdddf24f2503c8b069a72c4d004ebfa80e8fe041 (patch) | |
tree | 0a2487a75d8da319f2fc0b450f1e05e3cb695d3e /src/libutil/tests | |
parent | 984e521392b3f41f7cdab203e5c00f3e00e27a28 (diff) |
add hintfmt test
Diffstat (limited to 'src/libutil/tests')
-rw-r--r-- | src/libutil/tests/logging.cc | 18 |
1 files changed, 18 insertions, 0 deletions
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 <fstream> #include <gtest/gtest.h> @@ -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); + } + + + } |