mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
added unit tests
This commit is contained in:
parent
8a7a288b97
commit
8cc038960f
@ -211,6 +211,20 @@ TEST(json_writer, escape_string)
|
|||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(json_writer, dont_escape_string_uncecked)
|
||||||
|
{
|
||||||
|
wfp_json_writer * writer = wfp_impl_json_writer_create(128,0);
|
||||||
|
wfp_impl_json_writer_write_string_nocheck(writer, "\"\\/\b\f\n\r\t");
|
||||||
|
|
||||||
|
char * data = wfp_impl_json_writer_take_data(writer, nullptr);
|
||||||
|
|
||||||
|
ASSERT_STREQ("\"\"\\/\b\f\n\r\t\"", data);
|
||||||
|
|
||||||
|
wfp_impl_json_writer_dispose(writer);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(json_writer, write_bytes)
|
TEST(json_writer, write_bytes)
|
||||||
{
|
{
|
||||||
wfp_json_writer * writer = wfp_impl_json_writer_create(128,0);
|
wfp_json_writer * writer = wfp_impl_json_writer_create(128,0);
|
||||||
@ -223,3 +237,16 @@ TEST(json_writer, write_bytes)
|
|||||||
wfp_impl_json_writer_dispose(writer);
|
wfp_impl_json_writer_dispose(writer);
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(json_writer, expand_buffer)
|
||||||
|
{
|
||||||
|
wfp_json_writer * writer = wfp_impl_json_writer_create(1,0);
|
||||||
|
wfp_impl_json_writer_write_string(writer, "very large contents");
|
||||||
|
|
||||||
|
char * data = wfp_impl_json_writer_take_data(writer, nullptr);
|
||||||
|
|
||||||
|
ASSERT_STREQ("\"very large contents\"", data);
|
||||||
|
|
||||||
|
wfp_impl_json_writer_dispose(writer);
|
||||||
|
free(data);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user