mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
gtestutils: Define a custom g_print handler for TAP
When using TAP output in gtest, all the printed strings should be commented not to break the spec, so enforce this at GTest level, by ensuring that all the lines written via g_print() will be in the commented form and will respect the subtest indentation. As per this we can remove some custom code in g_test_log() as now there are very few cases in which we need to use the default print handler which is now private when testing.
This commit is contained in:
@@ -93,6 +93,16 @@ test_message (void)
|
||||
g_test_message ("\nTests that multi\nline\nmessage\nworks with leading and trailing too\n");
|
||||
}
|
||||
|
||||
static void
|
||||
test_print (void)
|
||||
{
|
||||
g_print ("Tests that single line message works\n");
|
||||
g_print ("test that multiple\nlines ");
|
||||
g_print ("can be ");
|
||||
g_print ("written ");
|
||||
g_print ("separately\n");
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -212,6 +222,10 @@ main (int argc,
|
||||
{
|
||||
g_test_add_func ("/message", test_message);
|
||||
}
|
||||
else if (g_strcmp0 (argv1, "print") == 0)
|
||||
{
|
||||
g_test_add_func ("/print", test_print);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
|
Reference in New Issue
Block a user