summaryrefslogtreecommitdiffstats
path: root/gnulib-local
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2006-12-04 13:35:38 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:14:26 +0200
commit720535066aef552d5171d04db2327d413b92c6ca (patch)
treed20c9191e2fd208abe50e7bd68a99f6ae9e6bfb6 /gnulib-local
parent70623d8ff3ac939f06c006eb804e84e4cc104efc (diff)
downloadexternal_gettext-720535066aef552d5171d04db2327d413b92c6ca.zip
external_gettext-720535066aef552d5171d04db2327d413b92c6ca.tar.gz
external_gettext-720535066aef552d5171d04db2327d413b92c6ca.tar.bz2
New module 'moo-tests'.
Diffstat (limited to 'gnulib-local')
-rw-r--r--gnulib-local/ChangeLog16
-rw-r--r--gnulib-local/Makefile.am12
-rw-r--r--gnulib-local/modules/moo-tests33
-rw-r--r--gnulib-local/tests/test-moo-aroot.oo.c6
-rw-r--r--gnulib-local/tests/test-moo-aroot.oo.h10
-rw-r--r--gnulib-local/tests/test-moo-assign.c32
-rw-r--r--gnulib-local/tests/test-moo-asub1.oo.c17
-rw-r--r--gnulib-local/tests/test-moo-asub1.oo.h10
-rw-r--r--gnulib-local/tests/test-moo-root.oo.c19
-rw-r--r--gnulib-local/tests/test-moo-root.oo.h10
-rw-r--r--gnulib-local/tests/test-moo-sub1.oo.c13
-rw-r--r--gnulib-local/tests/test-moo-sub1.oo.h10
-rw-r--r--gnulib-local/tests/test-moo-sub2.oo.c20
-rw-r--r--gnulib-local/tests/test-moo-sub2.oo.h10
14 files changed, 218 insertions, 0 deletions
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index 5a713ba..efde65c 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,5 +1,21 @@
2006-12-01 Bruno Haible <bruno@clisp.org>
+ * modules/moo-tests: New file.
+ * tests/test-moo-aroot.oo.c: New file.
+ * tests/test-moo-aroot.oo.h: New file.
+ * tests/test-moo-assign.c: New file.
+ * tests/test-moo-asub1.oo.c: New file.
+ * tests/test-moo-asub1.oo.h: New file.
+ * tests/test-moo-root.oo.c: New file.
+ * tests/test-moo-root.oo.h: New file.
+ * tests/test-moo-sub1.oo.c: New file.
+ * tests/test-moo-sub1.oo.h: New file.
+ * tests/test-moo-sub2.oo.c: New file.
+ * tests/test-moo-sub2.oo.h: New file.
+ * Makefile.am (EXTRA_DIST): Add the new files.
+
+2006-12-01 Bruno Haible <bruno@clisp.org>
+
* modules/term-ostream-tests: New file.
* tests/test-term-ostream.c: New file.
* tests/test-term-ostream-xterm: New file.
diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am
index ff11828..04c644c 100644
--- a/gnulib-local/Makefile.am
+++ b/gnulib-local/Makefile.am
@@ -288,6 +288,7 @@ modules/libglib \
modules/libxml \
modules/memory-ostream \
modules/moo \
+modules/moo-tests \
modules/no-c++ \
modules/ostream \
modules/progreloc \
@@ -306,6 +307,17 @@ modules/xalloc-die \
modules/xerror \
modules/xgetcwd \
modules/xreadlink \
+tests/test-moo-aroot.oo.c \
+tests/test-moo-aroot.oo.h \
+tests/test-moo-assign.c \
+tests/test-moo-asub1.oo.c \
+tests/test-moo-asub1.oo.h \
+tests/test-moo-root.oo.c \
+tests/test-moo-root.oo.h \
+tests/test-moo-sub1.oo.c \
+tests/test-moo-sub1.oo.h \
+tests/test-moo-sub2.oo.c \
+tests/test-moo-sub2.oo.h \
tests/test-term-ostream.c \
tests/test-term-ostream-xterm \
tests/test-term-ostream-xterm.out \
diff --git a/gnulib-local/modules/moo-tests b/gnulib-local/modules/moo-tests
new file mode 100644
index 0000000..77fb335
--- /dev/null
+++ b/gnulib-local/modules/moo-tests
@@ -0,0 +1,33 @@
+Files:
+tests/test-moo-root.oo.h
+tests/test-moo-root.oo.c
+tests/test-moo-sub1.oo.h
+tests/test-moo-sub1.oo.c
+tests/test-moo-sub2.oo.h
+tests/test-moo-sub2.oo.c
+tests/test-moo-aroot.oo.h
+tests/test-moo-aroot.oo.c
+tests/test-moo-asub1.oo.h
+tests/test-moo-asub1.oo.c
+tests/test-moo-assign.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+test-moo-root.h test-moo-root.c root.priv.h root.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-root.oo.c
+ $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-root.oo.c $(srcdir)/test-moo-root.oo.h
+
+test-moo-sub1.h test-moo-sub1.c sub1.priv.h sub1.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-sub1.oo.h test-moo-sub1.oo.c
+ $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-sub1.oo.c $(srcdir)/test-moo-sub1.oo.h $(srcdir)/test-moo-root.oo.h
+
+test-moo-sub2.h test-moo-sub2.c sub2.priv.h sub2.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-sub1.oo.h test-moo-sub2.oo.h test-moo-sub2.oo.c
+ $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-sub2.oo.c $(srcdir)/test-moo-sub2.oo.h $(srcdir)/test-moo-sub1.oo.h $(srcdir)/test-moo-root.oo.h
+
+test-moo-aroot.h test-moo-aroot.c aroot.priv.h aroot.vt.h : $(top_srcdir)/build-aux/moopp test-moo-aroot.oo.h test-moo-aroot.oo.c
+ $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-aroot.oo.c $(srcdir)/test-moo-aroot.oo.h
+
+test-moo-asub1.h test-moo-asub1.c asub1.priv.h asub1.vt.h : $(top_srcdir)/build-aux/moopp test-moo-aroot.oo.h test-moo-asub1.oo.h test-moo-asub1.oo.c
+ $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-asub1.oo.c $(srcdir)/test-moo-asub1.oo.h $(srcdir)/test-moo-aroot.oo.h
+
diff --git a/gnulib-local/tests/test-moo-aroot.oo.c b/gnulib-local/tests/test-moo-aroot.oo.c
new file mode 100644
index 0000000..ba67742
--- /dev/null
+++ b/gnulib-local/tests/test-moo-aroot.oo.c
@@ -0,0 +1,6 @@
+#include <config.h>
+
+/* Specification. */
+#include "test-moo-aroot.h"
+
+#pragma implementation
diff --git a/gnulib-local/tests/test-moo-aroot.oo.h b/gnulib-local/tests/test-moo-aroot.oo.h
new file mode 100644
index 0000000..ef07447
--- /dev/null
+++ b/gnulib-local/tests/test-moo-aroot.oo.h
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include "moo.h"
+
+/* Define an abstract root class. */
+struct aroot
+{
+methods:
+ int write (aroot_t x, void *buf, size_t len);
+ void do_free (aroot_t x);
+};
diff --git a/gnulib-local/tests/test-moo-assign.c b/gnulib-local/tests/test-moo-assign.c
new file mode 100644
index 0000000..079668b
--- /dev/null
+++ b/gnulib-local/tests/test-moo-assign.c
@@ -0,0 +1,32 @@
+/* Test assignments.
+ Errors are signalled in C++ mode only, not by a C compiler. */
+#include "test-moo-sub2.h"
+
+void foo ()
+{
+ root_t a;
+ sub1_t b;
+ sub2_t c;
+
+ /* Test initializations. */
+ root_t a1 = a;
+ root_t a2 = b;
+ root_t a3 = c;
+ sub1_t b1 = a; /* ERROR */
+ sub1_t b2 = b;
+ sub1_t b3 = c;
+ sub2_t c1 = a; /* ERROR */
+ sub2_t c2 = b; /* ERROR */
+ sub2_t c3 = c;
+
+ /* Test assignments. */
+ a = a1;
+ a = b1;
+ a = c1;
+ b = a2; /* ERROR */
+ b = b2;
+ b = c2;
+ c = a3; /* ERROR */
+ c = b3; /* ERROR */
+ c = c3;
+}
diff --git a/gnulib-local/tests/test-moo-asub1.oo.c b/gnulib-local/tests/test-moo-asub1.oo.c
new file mode 100644
index 0000000..bb5da83
--- /dev/null
+++ b/gnulib-local/tests/test-moo-asub1.oo.c
@@ -0,0 +1,17 @@
+#include <config.h>
+
+/* Specification. */
+#include "test-moo-asub1.h"
+
+#pragma implementation
+
+int asub1::write (asub1_t x, void *buf, size_t len)
+{
+ fwrite (buf, 1, len, x->fp);
+ return 0;
+}
+
+void asub1::do_free (asub1_t x)
+{
+ free (x);
+}
diff --git a/gnulib-local/tests/test-moo-asub1.oo.h b/gnulib-local/tests/test-moo-asub1.oo.h
new file mode 100644
index 0000000..3a6620d
--- /dev/null
+++ b/gnulib-local/tests/test-moo-asub1.oo.h
@@ -0,0 +1,10 @@
+#include "test-moo-aroot.h"
+
+#include <stdio.h>
+
+/* Define a subclass. */
+struct asub1 : struct aroot
+{
+ FILE *fp;
+methods:
+};
diff --git a/gnulib-local/tests/test-moo-root.oo.c b/gnulib-local/tests/test-moo-root.oo.c
new file mode 100644
index 0000000..00a72fe
--- /dev/null
+++ b/gnulib-local/tests/test-moo-root.oo.c
@@ -0,0 +1,19 @@
+#include <config.h>
+
+/* Specification. */
+#include "test-moo-root.h"
+
+#include <stdio.h>
+
+#pragma implementation
+
+int root::write (root_t x, void *buf, size_t len)
+{
+ fwrite (buf, 1, len, stdout);
+ return 0;
+}
+
+void root::do_free (root_t x)
+{
+ free (x);
+}
diff --git a/gnulib-local/tests/test-moo-root.oo.h b/gnulib-local/tests/test-moo-root.oo.h
new file mode 100644
index 0000000..4fe9d3f
--- /dev/null
+++ b/gnulib-local/tests/test-moo-root.oo.h
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include "moo.h"
+
+/* Define a root class. */
+struct root
+{
+methods:
+ int write (root_t x, void *buf, size_t len);
+ void do_free (root_t x);
+};
diff --git a/gnulib-local/tests/test-moo-sub1.oo.c b/gnulib-local/tests/test-moo-sub1.oo.c
new file mode 100644
index 0000000..bc928da
--- /dev/null
+++ b/gnulib-local/tests/test-moo-sub1.oo.c
@@ -0,0 +1,13 @@
+#include <config.h>
+
+/* Specification. */
+#include "test-moo-sub1.h"
+
+#pragma implementation
+
+/* Test an override. */
+int sub1::write (sub1_t x, void *buf, size_t len)
+{
+ fwrite (buf, 1, len, x->fp);
+ return 0;
+}
diff --git a/gnulib-local/tests/test-moo-sub1.oo.h b/gnulib-local/tests/test-moo-sub1.oo.h
new file mode 100644
index 0000000..5814394
--- /dev/null
+++ b/gnulib-local/tests/test-moo-sub1.oo.h
@@ -0,0 +1,10 @@
+#include "test-moo-root.h"
+
+#include <stdio.h>
+
+/* Define a subclass. */
+struct sub1 : struct root
+{
+ FILE *fp;
+methods:
+};
diff --git a/gnulib-local/tests/test-moo-sub2.oo.c b/gnulib-local/tests/test-moo-sub2.oo.c
new file mode 100644
index 0000000..7b61507
--- /dev/null
+++ b/gnulib-local/tests/test-moo-sub2.oo.c
@@ -0,0 +1,20 @@
+#include <config.h>
+
+/* Specification. */
+#include "test-moo-sub2.h"
+
+#include <stdio.h>
+
+#pragma implementation
+
+void
+sub2::begin_indent (sub2_t x)
+{
+ x->indent++;
+}
+
+void
+sub2::end_indent (sub2_t x)
+{
+ x->indent--;
+}
diff --git a/gnulib-local/tests/test-moo-sub2.oo.h b/gnulib-local/tests/test-moo-sub2.oo.h
new file mode 100644
index 0000000..d03b36a
--- /dev/null
+++ b/gnulib-local/tests/test-moo-sub2.oo.h
@@ -0,0 +1,10 @@
+#include "test-moo-sub1.h"
+
+/* Define a subclass. */
+struct sub2 : struct sub1
+{
+ int indent;
+methods:
+ void begin_indent (sub2_t x);
+ void end_indent (sub2_t x);
+};