From 3974618267bcc376f97b4d2dfb66d1e072810cfc Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 11 Jun 2008 21:55:02 +0200 Subject: [PATCH] new test cases from Pyrex --- tests/errors/e_badexcvaltype.pyx | 6 +++++ tests/errors/e_badfuncargtype.pyx | 12 ++++++++++ tests/errors/e_badpyparam.pyx | 7 ++++++ tests/errors/e_badtypeuse.pyx | 38 +++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 tests/errors/e_badexcvaltype.pyx create mode 100644 tests/errors/e_badfuncargtype.pyx create mode 100644 tests/errors/e_badpyparam.pyx create mode 100644 tests/errors/e_badtypeuse.pyx diff --git a/tests/errors/e_badexcvaltype.pyx b/tests/errors/e_badexcvaltype.pyx new file mode 100644 index 00000000..fef2aca1 --- /dev/null +++ b/tests/errors/e_badexcvaltype.pyx @@ -0,0 +1,6 @@ +cdef char *spam() except -1: + pass + +_ERRORS = u""" +1:26: Exception value incompatible with function return type +""" diff --git a/tests/errors/e_badfuncargtype.pyx b/tests/errors/e_badfuncargtype.pyx new file mode 100644 index 00000000..5e23d303 --- /dev/null +++ b/tests/errors/e_badfuncargtype.pyx @@ -0,0 +1,12 @@ +cdef struct Spam + +cdef extern int spam(void) # function argument cannot be void +cdef extern int grail(int i, void v) # function argument cannot be void +cdef int tomato(Spam s): # incomplete type + pass + +_ERRORS = u""" +3:21: Use spam() rather than spam(void) to declare a function with no arguments. +4:29: Use spam() rather than spam(void) to declare a function with no arguments. +5:16: Argument type 'Spam' is incomplete +""" diff --git a/tests/errors/e_badpyparam.pyx b/tests/errors/e_badpyparam.pyx new file mode 100644 index 00000000..8e9d04fd --- /dev/null +++ b/tests/errors/e_badpyparam.pyx @@ -0,0 +1,7 @@ +cdef struct Foo + +def f(Foo *p): + pass +_ERRORS = u""" +/Local/Projects/D/Pyrex/Source/Tests/Errors2/e_badpyparam.pyx:3:6: Cannot convert Python object argument to type 'Foo *' +""" diff --git a/tests/errors/e_badtypeuse.pyx b/tests/errors/e_badtypeuse.pyx new file mode 100644 index 00000000..3814a1ac --- /dev/null +++ b/tests/errors/e_badtypeuse.pyx @@ -0,0 +1,38 @@ +cdef struct Grail + +cdef extern object xobj # Python object cannot be extern +cdef object aobj[42] # array element cannot be Python object +cdef object *pobj # pointer base type cannot be Python object + +cdef int spam[] # incomplete variable type +cdef Grail g # incomplete variable type +cdef void nada # incomplete variable type + +cdef int a_spam[17][] # incomplete element type +cdef Grail a_g[42] # incomplete element type +cdef void a_nada[88] # incomplete element type + +cdef struct Eggs: + int spam[] + +cdef f(Grail g, # incomplete argument type + void v, # incomplete argument type + int a[]): + pass + +_ERRORS = u""" +3:19: Python object cannot be declared extern +4:16: Array element cannot be a Python object +5:12: Pointer base type cannot be a Python object +7:13: Variable type 'int []' is incomplete +8:11: Variable type 'Grail' is incomplete +9:10: Variable type 'void' is incomplete +11:15: Array element type 'int []' is incomplete +12:14: Array element type 'Grail' is incomplete +13:16: Array element type 'void' is incomplete +16:9: Variable type 'int []' is incomplete +#19:1: Function argument cannot be void +19:1: Use spam() rather than spam(void) to declare a function with no arguments. +18:7: Argument type 'Grail' is incomplete +19:1: Invalid use of 'void' +""" -- 2.26.2