* libtextstyle/gnulib-local/tests/test-memory-ostream.c: New file.
* libtextstyle/gnulib-local/modules/memory-ostream-tests: New file.
* libtextstyle/Makefile.am (EXTRA_DIST): Add them.
* libtextstyle/autogen.sh (GNULIB_MODULES): Add 'memory-ostream-tests'.
gnulib-local/modules/libglib \
gnulib-local/modules/libxml.diff \
gnulib-local/modules/memory-ostream \
+ gnulib-local/modules/memory-ostream-tests \
gnulib-local/modules/moo \
gnulib-local/modules/moo-tests \
gnulib-local/modules/noop-styled-ostream \
gnulib-local/modules/term-ostream \
gnulib-local/modules/term-ostream-tests \
gnulib-local/modules/term-styled-ostream \
+ gnulib-local/tests/test-memory-ostream.c \
gnulib-local/tests/test-moo-aroot.oo.c \
gnulib-local/tests/test-moo-aroot.oo.h \
gnulib-local/tests/test-moo-assign.c \
xalloc
xconcat-filename
+ memory-ostream-tests
term-ostream-tests
'
$GNULIB_TOOL --lib=libtextstyle --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
--- /dev/null
+Files:
+tests/test-memory-ostream.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-memory-ostream
+check_PROGRAMS += test-memory-ostream
--- /dev/null
+/* Test for the memory-ostream API. */
+
+#include <config.h>
+
+#include "memory-ostream.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+ memory_ostream_t stream = memory_ostream_create ();
+
+ ostream_write_str (stream, "foo");
+ ostream_printf (stream, "%d%d", 73, 55);
+ ostream_write_str (stream, "\n");
+
+ {
+ const void *buf;
+ size_t buflen;
+ memory_ostream_contents (stream, &buf, &buflen);
+
+ if (!(buflen == 8))
+ exit (2);
+ if (!(memcmp (buf, "foo7355\n", 8) == 0))
+ exit (3);
+
+ ostream_free (stream);
+ }
+
+ return 0;
+}