GNOME Bugzilla – Bug 754924
Improve test coverage of g_utf8_validate() by added known-length invocation
Last modified: 2015-09-13 17:37:53 UTC
The majority of tests written for g_utf8_validate() test validation of complete null-terminated strings with -1 given as the length parameter. The known-length invocation mode is only exercised by the few test cases that specify a non-negative string length. The code path that implements the known-length case, however, is different from the one for null-terminated validation. By making the test function also invoke g_utf8_validate() with computed length of the string we make sure that both paths are exercised for any sequences of interest.
Created attachment 311215 [details] [review] glib/tests/utf8-validate: test known-length case along with null-terminated For all test cases where the text length is given as -1, also call g_utf8_validate() with the actual string length to exercise the known-length case. Unknown-length and known-length validation use different code paths, but most of the tests only exercised with unknown-length parameter.
Review of attachment 311215 [details] [review]: Sure, that makes a lot of sense.
Attachment 311215 [details] pushed as 67c5bba - glib/tests/utf8-validate: test known-length case along with null-terminated