fix json test (null-terminate read)

This commit is contained in:
Enno Rehling 2014-11-04 07:57:29 +01:00
parent 8912a59ac4
commit 93cdec9ddc
1 changed files with 3 additions and 1 deletions

View File

@ -35,12 +35,14 @@ static void test_export_no_regions(CuTest * tc) {
char buf[1024];
stream out = { 0 };
int err;
size_t len;
mstream_init(&out);
err = json_export(&out, EXPORT_REGIONS);
CuAssertIntEquals(tc, 0, err);
out.api->rewind(out.handle);
out.api->read(out.handle, buf, sizeof(buf));
len = out.api->read(out.handle, buf, sizeof(buf));
buf[len] = '\0';
CuAssertStrEquals(tc, "{}", strip(buf));
mstream_done(&out);
}