From: Stefan Behnel Date: Wed, 25 Mar 2009 18:41:53 +0000 (+0100) Subject: extended error test cases X-Git-Tag: 0.11.1.alpha~33^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=da61f3343e2f52e5908b4dcfd4769aaf504be9d9;p=cython.git extended error test cases --- diff --git a/tests/bugs/return_outside_function_T135.pyx b/tests/bugs/return_outside_function_T135.pyx index 3e1a416f..ba993ac7 100644 --- a/tests/bugs/return_outside_function_T135.pyx +++ b/tests/bugs/return_outside_function_T135.pyx @@ -1,12 +1,38 @@ + return 'bar' + class A: return None cdef class B: return None +try: return None +except: pass + +try: return None +finally: pass + +for i in (1,2): + return None + +while True: + return None + +if True: + return None +else: + return None + + _ERRORS = u''' -1:0: Return not inside a function body -3:4: Return not inside a function body -6:4: Return not inside a function body + 2:0: Return not inside a function body + 5:4: Return not inside a function body + 8:4: Return not inside a function body +10:5: Return not inside a function body +13:5: Return not inside a function body +17:4: Return not inside a function body +20:4: Return not inside a function body +23:4: Return not inside a function body +25:4: Return not inside a function body ''' diff --git a/tests/errors/break_outside_loop.pyx b/tests/errors/break_outside_loop.pyx new file mode 100644 index 00000000..81508727 --- /dev/null +++ b/tests/errors/break_outside_loop.pyx @@ -0,0 +1,33 @@ + +break + +class A: + break + +cdef class B: + break + +def test(): + break + +try: break +except: pass + +try: break +finally: pass + +if True: + break +else: + break + + +_ERRORS = u''' + 2:0: break statement not inside loop + 5:4: break statement not inside loop + 8:4: break statement not inside loop +11:4: break statement not inside loop +16:5: break statement not inside loop +20:4: break statement not inside loop +22:4: break statement not inside loop +''' diff --git a/tests/errors/continue_outside_loop.pyx b/tests/errors/continue_outside_loop.pyx new file mode 100644 index 00000000..6a2ef523 --- /dev/null +++ b/tests/errors/continue_outside_loop.pyx @@ -0,0 +1,33 @@ + +continue + +class A: + continue + +cdef class B: + continue + +def test(): + continue + +try: continue +except: pass + +try: continue +finally: pass + +if True: + continue +else: + continue + + +_ERRORS = u''' + 2:0: continue statement not inside loop + 5:4: continue statement not inside loop + 8:4: continue statement not inside loop +11:4: continue statement not inside loop +16:5: continue statement not inside loop +20:4: continue statement not inside loop +22:4: continue statement not inside loop +'''