diff --git a/testsuite/sexp-format-test.c b/testsuite/sexp-format-test.c index cc2dfd15f2934ab621da85f6453ce0377cd3280e..b87c25380ee26ccf9d51e0e78ac27892d809e48d 100644 --- a/testsuite/sexp-format-test.c +++ b/testsuite/sexp-format-test.c @@ -83,8 +83,23 @@ test_main(void) "foo", "xxxxxxxxxxxxxxxxx") == strlen(e)); - ASSERT(sexp_format(NULL, "(%0s(%0s%0s))", - "foo", "bar", "xxxxxxxxxxxxxxxxx") + ASSERT(sexp_format(NULL, "(%0s(bar %0s))", + "foo", "xxxxxxxxxxxxxxxxx") + == strlen(e)); + + ASSERT(buffer.size == strlen(e)); + ASSERT(MEMEQ(buffer.size, buffer.contents, e)); + } + { + const uint8_t e[] = "(3:foo(3:bar17:xxxxxxxxxxxxxxxxx))"; + + nettle_buffer_init(&buffer); + ASSERT(sexp_format(&buffer, "(%0s(bar xxxxxxxxxxxxxxxxx))", + "foo") + == strlen(e)); + + ASSERT(sexp_format(NULL, "(%0s(bar xxxxxxxxxxxxxxxxx))", + "foo") == strlen(e)); ASSERT(buffer.size == strlen(e));