[glib/wip/issue2323-2-66: 3/5] io-channel test: Add coverage for g_io_channel_set_line_term(., ., -1)




commit d9db1faac565beac55582488583fad0a82992319
Author: Simon McVittie <smcv collabora com>
Date:   Mon Feb 8 10:28:25 2021 +0000

    io-channel test: Add coverage for g_io_channel_set_line_term(., ., -1)
    
    Signed-off-by: Simon McVittie <smcv collabora com>
    (cherry picked from commit 63f37f8c3ba4d523cb39f03ce05abb8adde5b0c7)

 glib/tests/io-channel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/io-channel.c b/glib/tests/io-channel.c
index ff53fcef7..4a1b10876 100644
--- a/glib/tests/io-channel.c
+++ b/glib/tests/io-channel.c
@@ -49,8 +49,10 @@ test_read_line_embedded_nuls (void)
   channel = g_io_channel_new_file (filename, "r", &local_error);
   g_assert_no_error (local_error);
 
-  /* Only break on newline characters, not nuls. */
-  g_io_channel_set_line_term (channel, "\n", 1);
+  /* Only break on newline characters, not nuls.
+   * Use length -1 here to exercise glib#2323; the case where length > 0
+   * is covered in glib/tests/protocol.c. */
+  g_io_channel_set_line_term (channel, "\n", -1);
   g_io_channel_set_encoding (channel, NULL, &local_error);
   g_assert_no_error (local_error);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]