aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-11-16 16:26:29 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-11-16 16:41:53 +0100
commitef84c780bb901011e090b9f12d293d136193a428 (patch)
tree2ba8ce71f17094c35e03dda80b6868bab1c622f7 /src/libutil/tests
parent0d6419ad87f5a569da182de1be54bce735245512 (diff)
filterANSIEscapes(): Handle UTF-8 characters
Diffstat (limited to 'src/libutil/tests')
-rw-r--r--src/libutil/tests/tests.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/tests/tests.cc b/src/libutil/tests/tests.cc
index ffba832d8..35a5d27bb 100644
--- a/src/libutil/tests/tests.cc
+++ b/src/libutil/tests/tests.cc
@@ -587,4 +587,14 @@ namespace nix {
ASSERT_EQ(filterANSIEscapes(s, true), "foo bar baz" );
}
+
+ TEST(filterANSIEscapes, utf8) {
+ ASSERT_EQ(filterANSIEscapes("foobar", true, 5), "fooba");
+ ASSERT_EQ(filterANSIEscapes("fóóbär", true, 6), "fóóbär");
+ ASSERT_EQ(filterANSIEscapes("fóóbär", true, 5), "fóóbä");
+ ASSERT_EQ(filterANSIEscapes("fóóbär", true, 3), "fóó");
+ ASSERT_EQ(filterANSIEscapes("f€€bär", true, 4), "f€€b");
+ ASSERT_EQ(filterANSIEscapes("f𐍈𐍈bär", true, 4), "f𐍈𐍈b");
+ }
+
}