mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
gtestutils: Do not allow newlines in Bail out! messages
It would break TAP parsing, so let's just print all inline
This commit is contained in:
parent
a3f26bd509
commit
9cfae23915
@ -1135,9 +1135,19 @@ g_test_log (GTestLogType lbit,
|
|||||||
break;
|
break;
|
||||||
case G_TEST_LOG_ERROR:
|
case G_TEST_LOG_ERROR:
|
||||||
if (test_tap_log)
|
if (test_tap_log)
|
||||||
g_print ("%sBail out! %s\n", test_is_subtest ? "# " : "", string1);
|
{
|
||||||
|
char *message = g_strdup (string1);
|
||||||
|
char *line = message;
|
||||||
|
|
||||||
|
while ((line = strchr (line, '\n')))
|
||||||
|
*(line++) = ' ';
|
||||||
|
|
||||||
|
g_print ("%sBail out! %s\n", test_is_subtest ? "# " : "", g_strstrip (message));
|
||||||
|
}
|
||||||
else if (g_test_verbose ())
|
else if (g_test_verbose ())
|
||||||
g_print ("(ERROR: %s)\n", string1);
|
{
|
||||||
|
g_print ("(ERROR: %s)\n", string1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ test_fail (void)
|
|||||||
static void
|
static void
|
||||||
test_error (void)
|
test_error (void)
|
||||||
{
|
{
|
||||||
g_error ("This should error out\nBecause it's just wrong!");
|
g_error ("This should error out\nBecause it's just\nwrong!");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1730,7 +1730,7 @@ test_tap_error (void)
|
|||||||
g_assert_nonnull (interesting_lines);
|
g_assert_nonnull (interesting_lines);
|
||||||
interesting_lines += strlen (expected_tap_header);
|
interesting_lines += strlen (expected_tap_header);
|
||||||
|
|
||||||
g_assert_cmpstr (interesting_lines, ==, "# Bail out! GLib-FATAL-ERROR: This should error out\n"
|
g_assert_cmpstr (interesting_lines, ==, "# Bail out! GLib-FATAL-ERROR: This should error out "
|
||||||
"Because it's just wrong!\n");
|
"Because it's just wrong!\n");
|
||||||
|
|
||||||
g_free (output);
|
g_free (output);
|
||||||
@ -1771,7 +1771,7 @@ test_tap_error_and_pass (void)
|
|||||||
g_assert_nonnull (interesting_lines);
|
g_assert_nonnull (interesting_lines);
|
||||||
interesting_lines += strlen (expected_tap_header);
|
interesting_lines += strlen (expected_tap_header);
|
||||||
|
|
||||||
g_assert_cmpstr (interesting_lines, ==, "# Bail out! GLib-FATAL-ERROR: This should error out\n"
|
g_assert_cmpstr (interesting_lines, ==, "# Bail out! GLib-FATAL-ERROR: This should error out "
|
||||||
"Because it's just wrong!\n");
|
"Because it's just wrong!\n");
|
||||||
|
|
||||||
g_free (output);
|
g_free (output);
|
||||||
|
Loading…
Reference in New Issue
Block a user