diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-09-18 11:52:14 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-09-19 11:49:03 -0400 |
commit | 7991ac34ab08421415b907e42775c5539a4a5bbb (patch) | |
tree | 91352e7b044e6073dc39d6daf1f55273784c89ff /src/test | |
parent | 894a156de7cace3210a60c29cfa14934fdea41ea (diff) |
shared/utf8: merge implementations, remove cruft
This unifies the utf8 handling code which was previously duplicated in
udev and systemd.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-utf8.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c index d2b9771f4b..26cc37bd6e 100644 --- a/src/test/test-utf8.c +++ b/src/test/test-utf8.c @@ -47,6 +47,12 @@ static void test_udev_encode_string(void) { assert_se(expect_encoded_as("s/ash/ng", "s\\x2fash\\x2fng")); } +static void test_utf8_is_printable(void) { + assert_se(utf8_is_printable("ascii is valid\tunicode", 22)); + assert_se(utf8_is_printable("\342\204\242", 3)); + assert_se(!utf8_is_printable("\341\204", 2)); +} + static void test_utf8_is_valid(void) { assert_se(utf8_is_valid("ascii is valid unicode")); assert_se(utf8_is_valid("\341\204\242")); @@ -55,5 +61,8 @@ static void test_utf8_is_valid(void) { int main(int argc, char *argv[]) { test_utf8_is_valid(); + test_utf8_is_printable(); test_udev_encode_string(); + + return 0; } |