more error tests, some failing
authorStefan Behnel <scoder@users.berlios.de>
Wed, 11 Jun 2008 20:01:29 +0000 (22:01 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 11 Jun 2008 20:01:29 +0000 (22:01 +0200)
42 files changed:
tests/errors/cdefkwargs.pyx [new file with mode: 0644]
tests/errors/e_addop.pyx [new file with mode: 0644]
tests/errors/e_argdefault.pyx [new file with mode: 0644]
tests/errors/e_ass.pyx [new file with mode: 0644]
tests/errors/e_assnone.pyx [new file with mode: 0644]
tests/errors/e_bitop.pyx [new file with mode: 0644]
tests/errors/e_cdef_missing_declarator.pyx [new file with mode: 0644]
tests/errors/e_cdefemptysue.pyx [new file with mode: 0644]
tests/errors/e_cenum.pyx [new file with mode: 0644]
tests/errors/e_cmethbasematch.pyx [new file with mode: 0644]
tests/errors/e_cmp.pyx [new file with mode: 0644]
tests/errors/e_cstruct.pyx [new file with mode: 0644]
tests/errors/e_ctypedefforward.pyx [new file with mode: 0644]
tests/errors/e_ctypedefornot.pyx [new file with mode: 0644]
tests/errors/e_declarations.pyx [new file with mode: 0644]
tests/errors/e_del.pyx [new file with mode: 0644]
tests/errors/e_excvalfunctype.pyx [new file with mode: 0644]
tests/errors/e_exestmtinexttype.pyx [new file with mode: 0644]
tests/errors/e_extmember.pyx [new file with mode: 0644]
tests/errors/e_extweakref.pyx [new file with mode: 0644]
tests/errors/e_index.pyx [new file with mode: 0644]
tests/errors/e_modop.pyx [new file with mode: 0644]
tests/errors/e_multass.pyx [new file with mode: 0644]
tests/errors/e_nargs.pyx [new file with mode: 0644]
tests/errors/e_nogilcmeth.pyx [new file with mode: 0644]
tests/errors/e_nogilfunctype.pyx [new file with mode: 0644]
tests/errors/e_notnone.pyx [new file with mode: 0644]
tests/errors/e_notnone2.pyx [new file with mode: 0644]
tests/errors/e_numop.pyx [new file with mode: 0644]
tests/errors/e_powop.pyx [new file with mode: 0644]
tests/errors/e_pyobinstruct.pyx [new file with mode: 0644]
tests/errors/e_redeclmeth.pyx [new file with mode: 0644]
tests/errors/e_return.pyx [new file with mode: 0644]
tests/errors/e_sizeofincomplete.pyx [new file with mode: 0644]
tests/errors/e_slice.pyx [new file with mode: 0644]
tests/errors/e_subop.pyx [new file with mode: 0644]
tests/errors/e_tempcast.pyx [new file with mode: 0644]
tests/errors/e_undefexttype.pyx [new file with mode: 0644]
tests/errors/e_unop.pyx [new file with mode: 0644]
tests/errors/e_while.pyx [new file with mode: 0644]
tests/errors/empty.pyx [new file with mode: 0644]
tests/errors/nogilcmeth.pyx [new file with mode: 0644]

diff --git a/tests/errors/cdefkwargs.pyx b/tests/errors/cdefkwargs.pyx
new file mode 100644 (file)
index 0000000..d0d3385
--- /dev/null
@@ -0,0 +1,25 @@
+__doc__ = u"""
+    >>> call2()
+    >>> call3()
+    >>> call4()
+"""
+
+import sys, re
+if sys.version_info >= (2,6):
+    __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__)
+
+# the calls:
+
+def call2():
+    b(1,2)
+
+def call3():
+    b(1,2,3)
+
+def call4():
+    b(1,2,3,4)
+
+# the called function:
+
+cdef b(a, b, c=1, d=2):
+    pass
diff --git a/tests/errors/e_addop.pyx b/tests/errors/e_addop.pyx
new file mode 100644 (file)
index 0000000..78ebf2a
--- /dev/null
@@ -0,0 +1,7 @@
+def f():
+       cdef int int1, int3
+       cdef int *ptr1, *ptr2, *ptr3
+       ptr1 = ptr2 + ptr3 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_addop.pyx:4:13: Invalid operand types for '+' (int *; int *)
+"""
diff --git a/tests/errors/e_argdefault.pyx b/tests/errors/e_argdefault.pyx
new file mode 100644 (file)
index 0000000..331c115
--- /dev/null
@@ -0,0 +1,16 @@
+cdef spam(int i, char *s = "blarg", float f): # can't have default value
+       pass
+
+def swallow(x, y = 42, z): # non-default after default
+       pass
+
+cdef class Grail:
+
+       def __add__(x, y = 42): # can't have default value
+               pass
+
+_ERRORS = u"""
+1:9: Non-default argument follows default argument
+9:16: This argument cannot have a default value
+4:23: Non-default argument following default argument
+"""
diff --git a/tests/errors/e_ass.pyx b/tests/errors/e_ass.pyx
new file mode 100644 (file)
index 0000000..72287f7
--- /dev/null
@@ -0,0 +1,10 @@
+cdef void foo(obj):
+       cdef int i1
+       cdef char *p1
+       cdef int *p2
+       i1 = p1 # error
+       p2 = obj # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_ass.pyx:5:16: Cannot assign type 'char *' to 'int'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_ass.pyx:6:17: Cannot convert Python object to 'int *'
+"""
diff --git a/tests/errors/e_assnone.pyx b/tests/errors/e_assnone.pyx
new file mode 100644 (file)
index 0000000..de660b3
--- /dev/null
@@ -0,0 +1,5 @@
+cdef void spam():
+       None = 42
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_assnone.pyx:2:1: Cannot assign to or delete this
+"""
diff --git a/tests/errors/e_bitop.pyx b/tests/errors/e_bitop.pyx
new file mode 100644 (file)
index 0000000..40d67f2
--- /dev/null
@@ -0,0 +1,7 @@
+def f():
+       cdef int int1, int2
+       cdef char *ptr
+       int1 = int2 | ptr # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_bitop.pyx:4:13: Invalid operand types for '|' (int; char *)
+"""
diff --git a/tests/errors/e_cdef_missing_declarator.pyx b/tests/errors/e_cdef_missing_declarator.pyx
new file mode 100644 (file)
index 0000000..92772a6
--- /dev/null
@@ -0,0 +1,7 @@
+cdef int
+
+cdef extern from *:
+       void f(int)
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cdef_missing_declarator.pyx:1:8: Empty declarator
+"""
diff --git a/tests/errors/e_cdefemptysue.pyx b/tests/errors/e_cdefemptysue.pyx
new file mode 100644 (file)
index 0000000..efdf46a
--- /dev/null
@@ -0,0 +1,13 @@
+cdef struct spam:
+       pass
+
+ctypedef union eggs:
+       pass
+
+cdef enum ham:
+       pass
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cdefemptysue.pyx:1:5: Empty struct or union definition not allowed outside a 'cdef extern from' block
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cdefemptysue.pyx:4:0: Empty struct or union definition not allowed outside a 'cdef extern from' block
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cdefemptysue.pyx:7:5: Empty enum definition not allowed outside a 'cdef extern from' block
+"""
diff --git a/tests/errors/e_cenum.pyx b/tests/errors/e_cenum.pyx
new file mode 100644 (file)
index 0000000..ea5298d
--- /dev/null
@@ -0,0 +1,10 @@
+cdef enum Spam:
+       a, b, c
+
+cdef void f():
+       global a
+       a = 42      # assignment to non-lvalue
+       
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cenum.pyx:6:3: Assignment to non-lvalue 'a'
+"""
diff --git a/tests/errors/e_cmethbasematch.pyx b/tests/errors/e_cmethbasematch.pyx
new file mode 100644 (file)
index 0000000..bc59e62
--- /dev/null
@@ -0,0 +1,11 @@
+cdef class C:
+       cdef void f(self):
+               pass
+
+cdef class D(C):
+       cdef void f(self, int x):
+               pass
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:6:6: Signature does not match previous declaration
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_cmethbasematch.pyx:2:6: Previous declaration is here
+"""
diff --git a/tests/errors/e_cmp.pyx b/tests/errors/e_cmp.pyx
new file mode 100644 (file)
index 0000000..68d238e
--- /dev/null
@@ -0,0 +1,10 @@
+cdef void foo():
+       cdef int bool, int1
+       cdef char *ptr2
+       cdef int *ptr3
+       bool = int1 == ptr2 # error
+       bool = ptr2 == ptr3 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cmp.pyx:5:13: Invalid types for '==' (int, char *)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cmp.pyx:6:13: Invalid types for '==' (char *, int *)
+"""
diff --git a/tests/errors/e_cstruct.pyx b/tests/errors/e_cstruct.pyx
new file mode 100644 (file)
index 0000000..05895cb
--- /dev/null
@@ -0,0 +1,32 @@
+cdef struct Spam:
+       int i
+       char c
+       float *p[42]
+       obj             # error - py object
+
+cdef struct Spam: # error - redefined
+       int j
+
+cdef struct Grail
+
+cdef void eggs(Spam s):
+       cdef int j
+       cdef Grail *gp
+       j = s.k # error - undef attribute
+       j = s.p # type error
+       s.p = j # type error
+       j = j.i # error - no attributes
+       j.i = j # error - no attributes
+       j = gp.x # error - incomplete type
+       gp.x = j # error - incomplete type
+       _ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:5:36: C struct/union member cannot be a Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:7:5: 'Spam' already defined
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:15:6: Object of type 'Spam' has no attribute 'k'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:16:6: Cannot assign type 'float *[42]' to 'int'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:17:21: Cannot assign type 'int' to 'float *[42]'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:18:6: Object of type 'int' has no attribute 'i'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:19:2: Object of type 'int' has no attribute 'i'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:20:7: Cannot select attribute of incomplete type 'Grail'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:21:3: Cannot select attribute of incomplete type 'Grail'
+"""
diff --git a/tests/errors/e_ctypedefforward.pyx b/tests/errors/e_ctypedefforward.pyx
new file mode 100644 (file)
index 0000000..6fdeb2d
--- /dev/null
@@ -0,0 +1,18 @@
+ctypedef struct Spam
+ctypedef class Eggs
+
+cdef extern from *:
+       ctypedef struct Ham
+
+ctypedef struct Spam:
+       int i
+
+ctypedef class Eggs:
+       pass
+
+ctypedef struct Spam
+ctypedef class Eggs
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_ctypedefforward.pyx:1:0: Forward-referenced type must use 'cdef', not 'ctypedef'
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_ctypedefforward.pyx:2:0: Forward-referenced type must use 'cdef', not 'ctypedef'
+"""
diff --git a/tests/errors/e_ctypedefornot.pyx b/tests/errors/e_ctypedefornot.pyx
new file mode 100644 (file)
index 0000000..14b4242
--- /dev/null
@@ -0,0 +1,23 @@
+cdef struct Foo
+
+ctypedef struct Foo:
+       int i
+       
+ctypedef struct Blarg:
+       char c
+
+cdef struct Blarg
+
+cdef class Spam
+
+ctypedef class Spam:
+       pass
+       
+cdef Foo f
+cdef Blarg b
+
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_ctypedefornot.pyx:3:0: 'Foo' previously declared using 'cdef'
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_ctypedefornot.pyx:9:5: 'Blarg' previously declared using 'ctypedef'
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_ctypedefornot.pyx:13:0: 'Spam' previously declared using 'cdef'
+"""
diff --git a/tests/errors/e_declarations.pyx b/tests/errors/e_declarations.pyx
new file mode 100644 (file)
index 0000000..333275b
--- /dev/null
@@ -0,0 +1,15 @@
+cdef extern void fa[5]()
+cdef extern int af()[5]
+cdef extern int ff()()
+
+cdef void f():
+       cdef void *p
+       cdef int (*h)()
+       h = <int ()()>f
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:1:19: Array element cannot be a function
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:2:18: Function cannot return an array
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:3:18: Function cannot return a function
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:8:10: Function cannot return a function
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_declarations.pyx:8:5: Cannot cast to a function type
+"""
diff --git a/tests/errors/e_del.pyx b/tests/errors/e_del.pyx
new file mode 100644 (file)
index 0000000..b657ecd
--- /dev/null
@@ -0,0 +1,20 @@
+cdef struct S:
+       int m
+
+def f(a):
+       cdef int i, x[2]
+       cdef S s
+       global j
+       del f() # error
+       del i # error: deletion of non-Python object
+       del j # error: deletion of non-Python object
+       del a # error: deletion of local name not supported
+       del x[i] # error: deletion of non-Python object
+       del s.m # error: deletion of non-Python object
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_del.pyx:8:6: Cannot assign to or delete this
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_del.pyx:9:45: Deletion of non-Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_del.pyx:12:6: Deletion of non-Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_del.pyx:13:6: Deletion of non-Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_del.pyx:11:52: Deletion of local or C global name not supported
+"""
diff --git a/tests/errors/e_excvalfunctype.pyx b/tests/errors/e_excvalfunctype.pyx
new file mode 100644 (file)
index 0000000..4147bb7
--- /dev/null
@@ -0,0 +1,12 @@
+ctypedef int (*spamfunc)(int, char *) except 42
+ctypedef int (*grailfunc)(int, char *)
+
+cdef grailfunc grail
+cdef spamfunc spam
+
+grail = spam # type mismatch
+spam = grail # type mismatch
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_excvalfunctype.pyx:7:28: Cannot assign type 'e_excvalfunctype.spamfunc' to 'e_excvalfunctype.grailfunc'
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_excvalfunctype.pyx:8:28: Cannot assign type 'e_excvalfunctype.grailfunc' to 'e_excvalfunctype.spamfunc'
+"""
diff --git a/tests/errors/e_exestmtinexttype.pyx b/tests/errors/e_exestmtinexttype.pyx
new file mode 100644 (file)
index 0000000..a9afdbc
--- /dev/null
@@ -0,0 +1,5 @@
+cdef class Spam:
+       answer = 42
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_exestmtinexttype.pyx:2:1: Executable statement not allowed here
+"""
diff --git a/tests/errors/e_extmember.pyx b/tests/errors/e_extmember.pyx
new file mode 100644 (file)
index 0000000..73b1fdd
--- /dev/null
@@ -0,0 +1,5 @@
+cdef class Spam:
+       cdef public Spam e
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_extmember.pyx:2:18: Non-generic Python attribute cannot be exposed for writing from Python
+"""
diff --git a/tests/errors/e_extweakref.pyx b/tests/errors/e_extweakref.pyx
new file mode 100644 (file)
index 0000000..1708644
--- /dev/null
@@ -0,0 +1,20 @@
+cdef class C:
+       cdef object __weakref__
+
+cdef class D:
+       cdef public object __weakref__
+
+cdef class E:
+       cdef readonly object __weakref__
+
+cdef void f():
+       cdef C c
+       cdef object x
+       x = c.__weakref__
+       c.__weakref__ = x
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_extweakref.pyx:5:20: Special attribute __weakref__ cannot be exposed to Python
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_extweakref.pyx:8:22: Special attribute __weakref__ cannot be exposed to Python
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_extweakref.pyx:13:6: Illegal use of special attribute __weakref__
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_extweakref.pyx:14:2: Illegal use of special attribute __weakref__
+"""
diff --git a/tests/errors/e_index.pyx b/tests/errors/e_index.pyx
new file mode 100644 (file)
index 0000000..e8ac7ee
--- /dev/null
@@ -0,0 +1,14 @@
+def f(obj1, obj2):
+       cdef int int1, int2, int3
+       cdef float flt1, *ptr1
+       cdef int array1[42]
+       int1 = array1[flt1] # error
+       int1 = array1[ptr1] # error
+       int1 = int2[int3] # error
+       obj1 = obj2[ptr1] # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_index.pyx:5:14: Invalid index type 'float'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_index.pyx:6:14: Invalid index type 'float *'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_index.pyx:7:12: Attempting to index non-array type 'int'
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_index.pyx:8:17: Cannot convert 'float *' to Python object
+"""
diff --git a/tests/errors/e_modop.pyx b/tests/errors/e_modop.pyx
new file mode 100644 (file)
index 0000000..926c3fb
--- /dev/null
@@ -0,0 +1,6 @@
+def f():
+       cdef float flt1, flt2, flt3
+       flt1 = flt2 % flt3 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_modop.pyx:3:13: Invalid operand types for '%' (float; float)
+"""
diff --git a/tests/errors/e_multass.pyx b/tests/errors/e_multass.pyx
new file mode 100644 (file)
index 0000000..b27d243
--- /dev/null
@@ -0,0 +1,7 @@
+def f(obj1a, obj1b):
+       cdef int int1, int2, int3
+       cdef int *ptr2
+       int1, int3, obj1a = int2, ptr2, obj1b # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_multass.pyx:4:31: Cannot assign type 'int *' to 'int'
+"""
diff --git a/tests/errors/e_nargs.pyx b/tests/errors/e_nargs.pyx
new file mode 100644 (file)
index 0000000..7fe4d7f
--- /dev/null
@@ -0,0 +1,16 @@
+cdef extern grail(char *s, int i)
+cdef extern spam(char *s, int i,...)
+
+cdef f():
+       grail() # too few args
+       grail("foo") # too few args
+       grail("foo", 42, 17) # too many args
+       spam() # too few args
+       spam("blarg") # too few args
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_nargs.pyx:5:6: Call with wrong number of arguments (expected 2, got 0)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_nargs.pyx:6:6: Call with wrong number of arguments (expected 2, got 1)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_nargs.pyx:7:6: Call with wrong number of arguments (expected 2, got 3)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_nargs.pyx:8:5: Call with wrong number of arguments (expected at least 2, got 0)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_nargs.pyx:9:5: Call with wrong number of arguments (expected at least 2, got 1)
+"""
diff --git a/tests/errors/e_nogilcmeth.pyx b/tests/errors/e_nogilcmeth.pyx
new file mode 100644 (file)
index 0000000..2efdbcc
--- /dev/null
@@ -0,0 +1,8 @@
+cdef class C:
+       cdef void f(self):
+               pass
+
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_nogilcmeth.pyx:2:6: Signature does not match previous declaration
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_nogilcmeth.pxd:2:12: Previous declaration is here
+"""
diff --git a/tests/errors/e_nogilfunctype.pyx b/tests/errors/e_nogilfunctype.pyx
new file mode 100644 (file)
index 0000000..048f652
--- /dev/null
@@ -0,0 +1,8 @@
+cdef extern from *:
+       cdef void f() nogil
+       cdef void (*fp)()
+
+fp = f
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors3/e_nogilfunctype.pyx:5:6: Cannot assign type 'void (void) nogil' to 'void (*)(void)'
+"""
diff --git a/tests/errors/e_notnone.pyx b/tests/errors/e_notnone.pyx
new file mode 100644 (file)
index 0000000..dac4568
--- /dev/null
@@ -0,0 +1,7 @@
+cdef extern class Grail.Shrubbery
+
+cdef void spam(Shrubbery sh not None):
+       pass
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_notnone.pyx:3:15: 'not None' only allowed in Python functions
+"""
diff --git a/tests/errors/e_notnone2.pyx b/tests/errors/e_notnone2.pyx
new file mode 100644 (file)
index 0000000..d5dead7
--- /dev/null
@@ -0,0 +1,6 @@
+def eggs(int x not None, y not None):
+       pass
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_notnone2.pyx:1:0: Only extension type arguments can have 'not None'
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_notnone2.pyx:1:0: Only extension type arguments can have 'not None'
+"""
diff --git a/tests/errors/e_numop.pyx b/tests/errors/e_numop.pyx
new file mode 100644 (file)
index 0000000..3fbb82f
--- /dev/null
@@ -0,0 +1,7 @@
+def f():
+       cdef int int1, int2
+       cdef int *ptr
+       int1 = int2 * ptr # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_numop.pyx:4:13: Invalid operand types for '*' (int; int *)
+"""
diff --git a/tests/errors/e_powop.pyx b/tests/errors/e_powop.pyx
new file mode 100644 (file)
index 0000000..1c10c65
--- /dev/null
@@ -0,0 +1,9 @@
+def f():
+       cdef char *str1
+       cdef float flt1, flt2, flt3
+       flt1 = str1 ** flt3 # error
+       flt1 = flt2 ** str1 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_powop.pyx:4:13: Invalid operand types for '**' (char *; float)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_powop.pyx:5:13: Invalid operand types for '**' (float; char *)
+"""
diff --git a/tests/errors/e_pyobinstruct.pyx b/tests/errors/e_pyobinstruct.pyx
new file mode 100644 (file)
index 0000000..fd7e951
--- /dev/null
@@ -0,0 +1,9 @@
+cdef struct spam:
+       object parrot
+
+def f():
+       cdef spam s
+       s.parrot = x
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_pyobinstruct.pyx:2:8: C struct/union member cannot be a Python object
+"""
diff --git a/tests/errors/e_redeclmeth.pyx b/tests/errors/e_redeclmeth.pyx
new file mode 100644 (file)
index 0000000..062f4c8
--- /dev/null
@@ -0,0 +1,8 @@
+class C:
+       def f(self):
+               pass
+       def f(self):
+               pass
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_redeclmeth.pyx:4:1: 'f' already declared
+"""
diff --git a/tests/errors/e_return.pyx b/tests/errors/e_return.pyx
new file mode 100644 (file)
index 0000000..350ffc7
--- /dev/null
@@ -0,0 +1,13 @@
+cdef void g():
+       cdef int i
+       return i # error
+
+cdef int h():
+       cdef int *p
+       return # error
+       return p # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_return.pyx:3:17: Return with value in void function
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_return.pyx:7:1: Return value required
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_return.pyx:8:17: Cannot assign type 'int *' to 'int'
+"""
diff --git a/tests/errors/e_sizeofincomplete.pyx b/tests/errors/e_sizeofincomplete.pyx
new file mode 100644 (file)
index 0000000..9e1e77e
--- /dev/null
@@ -0,0 +1,6 @@
+cdef struct unbekannt
+cdef int n
+n = sizeof(unbekannt)
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_sizeofincomplete.pyx:3:4: Cannot take sizeof incomplete type 'unbekannt'
+"""
diff --git a/tests/errors/e_slice.pyx b/tests/errors/e_slice.pyx
new file mode 100644 (file)
index 0000000..db7e462
--- /dev/null
@@ -0,0 +1,10 @@
+def f(obj2):
+       cdef int *ptr1
+       obj1 = obj2[ptr1::] # error
+       obj1 = obj2[:ptr1:] # error
+       obj1 = obj2[::ptr1] # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_slice.pyx:3:17: Cannot convert 'int *' to Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_slice.pyx:4:18: Cannot convert 'int *' to Python object
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_slice.pyx:5:19: Cannot convert 'int *' to Python object
+"""
diff --git a/tests/errors/e_subop.pyx b/tests/errors/e_subop.pyx
new file mode 100644 (file)
index 0000000..9ba4c5f
--- /dev/null
@@ -0,0 +1,9 @@
+def f():
+       cdef int int2
+       cdef char *ptr1, *ptr2, *ptr3
+       ptr1 = int2 - ptr3 # error
+       ptr1 = ptr2 - ptr3 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_subop.pyx:4:13: Invalid operand types for '-' (int; char *)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_subop.pyx:5:13: Cannot assign type 'int' to 'char *'
+"""
diff --git a/tests/errors/e_tempcast.pyx b/tests/errors/e_tempcast.pyx
new file mode 100644 (file)
index 0000000..5694b67
--- /dev/null
@@ -0,0 +1,7 @@
+def foo(obj):
+       cdef int *p
+       p = <int *>blarg # okay
+       p = <int *>(foo + blarg) # error - temporary
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_tempcast.pyx:4:5: Casting temporary Python object to non-Python type
+"""
diff --git a/tests/errors/e_undefexttype.pyx b/tests/errors/e_undefexttype.pyx
new file mode 100644 (file)
index 0000000..89300a2
--- /dev/null
@@ -0,0 +1,6 @@
+cdef class Spam
+cdef extern class external.Eggs
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_undefexttype.pyx:1:5: C class 'Spam' is declared but not defined
+/Local/Projects/D/Pyrex/Source/Tests/Errors1/e_undefexttype.pyx:2:5: C class 'Eggs' is declared but not defined
+"""
diff --git a/tests/errors/e_unop.pyx b/tests/errors/e_unop.pyx
new file mode 100644 (file)
index 0000000..9100d71
--- /dev/null
@@ -0,0 +1,9 @@
+def f():
+       cdef int int1
+       cdef char *str2
+       int1 = -str2 # error
+       int1 = ~str2 # error
+_ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_unop.pyx:4:8: Invalid operand type for '-' (char *)
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_unop.pyx:5:8: Invalid operand type for '~' (char *)
+"""
diff --git a/tests/errors/e_while.pyx b/tests/errors/e_while.pyx
new file mode 100644 (file)
index 0000000..aafcf9a
--- /dev/null
@@ -0,0 +1,8 @@
+def f(a, b):
+       cdef int i
+       break # error
+       continue # error
+       _ERRORS = u"""
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_while.pyx:3:1: break statement not inside loop
+/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_while.pyx:4:1: continue statement not inside loop
+"""
diff --git a/tests/errors/empty.pyx b/tests/errors/empty.pyx
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/errors/nogilcmeth.pyx b/tests/errors/nogilcmeth.pyx
new file mode 100644 (file)
index 0000000..536be3b
--- /dev/null
@@ -0,0 +1,7 @@
+cdef class C:
+    cdef void f(self):
+        pass
+
+_ERRORS = u"""
+2:6: Signature does not match previous declaration
+"""