tests: Use g_assert_*() rather than g_assert() in GDataInputStream tests

It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-10-12 12:56:00 +01:00
parent 3f5997f65d
commit 066fefafa0
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -80,9 +80,9 @@ test_read_lines (GDataStreamNewlineType newline_type)
lines[i] = "some_text"; lines[i] = "some_text";
base_stream = g_memory_input_stream_new (); base_stream = g_memory_input_stream_new ();
g_assert (base_stream != NULL); g_assert_nonnull (base_stream);
stream = G_INPUT_STREAM (g_data_input_stream_new (base_stream)); stream = G_INPUT_STREAM (g_data_input_stream_new (base_stream));
g_assert(stream != NULL); g_assert_nonnull (stream);
/* Byte order testing */ /* Byte order testing */
g_data_input_stream_set_byte_order (G_DATA_INPUT_STREAM (stream), G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN); g_data_input_stream_set_byte_order (G_DATA_INPUT_STREAM (stream), G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN);
@ -210,7 +210,7 @@ test_read_lines_LF_invalid_utf8 (void)
g_assert_no_error (error); g_assert_no_error (error);
else else
{ {
g_assert (error != NULL); g_assert_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE);
g_clear_error (&error); g_clear_error (&error);
g_free (line); g_free (line);
break; break;
@ -354,7 +354,7 @@ test_read_upto (void)
line++; line++;
stop_char = g_data_input_stream_read_byte (G_DATA_INPUT_STREAM (stream), NULL, &error); stop_char = g_data_input_stream_read_byte (G_DATA_INPUT_STREAM (stream), NULL, &error);
g_assert (memchr (DATA_SEP, stop_char, DATA_SEP_LEN) != NULL); g_assert_nonnull (memchr (DATA_SEP, stop_char, DATA_SEP_LEN));
g_assert_no_error (error); g_assert_no_error (error);
} }
g_free (data); g_free (data);