Regression test for #42.
authorNikita Nemkin <nikita@nemkin.ru>
Sat, 27 Apr 2013 03:40:55 +0000 (09:40 +0600)
committerNikita Nemkin <nikita@nemkin.ru>
Sat, 27 Apr 2013 03:40:55 +0000 (09:40 +0600)
tests/compile/const_T42.srctree [new file with mode: 0644]

diff --git a/tests/compile/const_T42.srctree b/tests/compile/const_T42.srctree
new file mode 100644 (file)
index 0000000..5538d36
--- /dev/null
@@ -0,0 +1,30 @@
+# tag: cpp
+PYTHON setup.py build_ext --inplace
+PYTHON -c "import test"
+
+######## test.pyx ########
+# distutils: language = c++
+
+cdef extern from "test.h":
+    ctypedef struct c_Test "Test":
+        const char *getString() except +RuntimeError
+
+cdef class Test:
+    cdef c_Test *thisptr
+    def getString(self):
+        return self.thisptr.getString()
+
+######## test.h ########
+
+static const char *astring = "123";
+class Test {
+public:
+    const char *getString(void) { return astring; }
+};
+
+######## setup.py ########
+
+from distutils.core import setup
+from Cython.Build.Dependencies import cythonize
+
+setup(name='test', ext_modules=cythonize('*.pyx'))