From c3b9af3831762d7548eb1e72cfb62ab95e0d8490 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 30 May 2020 21:32:05 +0200 Subject: common: bc_stdin_read() should set read length --- tests/common/check_stdin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/common/check_stdin.c b/tests/common/check_stdin.c index 716916d..3d90202 100644 --- a/tests/common/check_stdin.c +++ b/tests/common/check_stdin.c @@ -27,19 +27,23 @@ __wrap_fgetc(FILE *stream) static void test_read(void **state) { + assert_null(bc_stdin_read(NULL)); will_return(__wrap_fgetc, EOF); - char *t = bc_stdin_read(); + size_t len; + char *t = bc_stdin_read(&len); assert_non_null(t); assert_string_equal(t, ""); + assert_int_equal(len, 0); free(t); will_return(__wrap_fgetc, 'b'); will_return(__wrap_fgetc, 'o'); will_return(__wrap_fgetc, 'l'); will_return(__wrap_fgetc, 'a'); will_return(__wrap_fgetc, EOF); - t = bc_stdin_read(); + t = bc_stdin_read(&len); assert_non_null(t); assert_string_equal(t, "bola"); + assert_int_equal(len, 4); free(t); } -- cgit v1.2.3-18-g5258