aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-06 15:33:25 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-06 15:33:25 -0500
commit8020d6fb05d9477e77c6ca554dc1288873f6115c (patch)
treec3498e105bfd77c8691253f7a2a5464bc3206256 /src/test/test_util.c
parentba28704b296b1036151e4bfa97e7091d7639a573 (diff)
parentda716fdfbb08952b971882eba1dabca2fef9c7f3 (diff)
downloadtor-8020d6fb05d9477e77c6ca554dc1288873f6115c.tar.gz
tor-8020d6fb05d9477e77c6ca554dc1288873f6115c.zip
Merge remote-tracking branch 'tor-github/pr/464'
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 1a71da2794..bcface64fd 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4024,6 +4024,13 @@ test_util_string_is_utf8(void *ptr)
tt_int_op(1, OP_EQ, string_is_utf8("ascii\x7f\n", 7));
tt_int_op(1, OP_EQ, string_is_utf8("Risqu\u00e9=1", 9));
+ /* Test the utf8_no_bom function */
+ tt_int_op(0, OP_EQ, string_is_utf8_no_bom("\uFEFF", 3));
+ tt_int_op(0, OP_EQ, string_is_utf8_no_bom("\uFFFE", 3));
+ tt_int_op(0, OP_EQ, string_is_utf8_no_bom("\uFEFFlove", 7));
+ tt_int_op(1, OP_EQ, string_is_utf8_no_bom("loveandrespect",
+ strlen("loveandrespect")));
+
// Validate exactly 'len' bytes.
tt_int_op(0, OP_EQ, string_is_utf8("\0\x80", 2));
tt_int_op(0, OP_EQ, string_is_utf8("Risqu\u00e9=1", 6));