summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-02-25 23:38:47 +0100
committerCarl Hetherington <cth@carlh.net>2023-03-03 01:17:41 +0100
commit61614dcb37ce1bc3cf3fc2915ccac741cfef68e5 (patch)
treed7aabdeb32a79bc12c863e607ecc1101684ad31f /test
parent230e5c57553a8c19863bb1c9d0aa4136a359cf61 (diff)
Add word_wrap().
Diffstat (limited to 'test')
-rw-r--r--test/util_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/util_test.cc b/test/util_test.cc
index 872e6f885..49d0b3bc2 100644
--- a/test/util_test.cc
+++ b/test/util_test.cc
@@ -147,3 +147,11 @@ BOOST_AUTO_TEST_CASE (copy_in_bits_test)
check_file ("build/test/random.dat", "build/test/random.dat2");
}
}
+
+
+BOOST_AUTO_TEST_CASE(word_wrap_test)
+{
+ BOOST_CHECK_EQUAL(word_wrap("hello world", 8), "hello \nworld\n");
+ BOOST_CHECK(word_wrap("hello this is a longer bit of text and it should be word-wrapped", 31) == string{"hello this is a longer bit of \ntext and it should be word-\nwrapped\n"});
+ BOOST_CHECK_EQUAL(word_wrap("hellocan'twrapthissadly", 5), "hello\ncan't\nwrapt\nhissa\ndly\n");
+}