aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-30 21:32:05 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-30 21:37:00 +0200
commitc3b9af3831762d7548eb1e72cfb62ab95e0d8490 (patch)
tree9f63251e8e665ee798972832f26b1baf1c0a7ec3 /tests
parent9a3629921b250e7079be9abb5252381025c33354 (diff)
downloadblogc-c3b9af3831762d7548eb1e72cfb62ab95e0d8490.tar.gz
blogc-c3b9af3831762d7548eb1e72cfb62ab95e0d8490.tar.bz2
blogc-c3b9af3831762d7548eb1e72cfb62ab95e0d8490.zip
common: bc_stdin_read() should set read length
Diffstat (limited to 'tests')
-rw-r--r--tests/common/check_stdin.c8
1 files changed, 6 insertions, 2 deletions
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);
}