diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-26 17:32:27 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2000-09-26 17:32:27 (GMT) |
commit | d635b1d724e79a1d2dce416b29a95c389fdfab30 (patch) | |
tree | 91545a903b9628f4a592b6d911fd9bd23d7510b6 /Lib/dos-8x3/test_exc.py | |
parent | 0872e0585196a894c8c2c2dbea1a0fdd68391c90 (diff) | |
download | cpython-d635b1d724e79a1d2dce416b29a95c389fdfab30.zip cpython-d635b1d724e79a1d2dce416b29a95c389fdfab30.tar.gz cpython-d635b1d724e79a1d2dce416b29a95c389fdfab30.tar.bz2 |
The Usual
Diffstat (limited to 'Lib/dos-8x3/test_exc.py')
-rwxr-xr-x | Lib/dos-8x3/test_exc.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Lib/dos-8x3/test_exc.py b/Lib/dos-8x3/test_exc.py index 7ee203c..076f470 100755 --- a/Lib/dos-8x3/test_exc.py +++ b/Lib/dos-8x3/test_exc.py @@ -86,6 +86,55 @@ r(SyntaxError) try: exec '/\n' except SyntaxError: pass +# make sure the right exception message is raised for each of these +# code fragments: + +def ckmsg(src, msg): + try: + compile(src, '<fragment>', 'exec') + except SyntaxError, e: + print e.msg + if e.msg == msg: + print "ok" + else: + print "expected:", msg + else: + print "failed to get expected SyntaxError" + +s = '''\ +while 1: + try: + continue + except: + pass +''' +ckmsg(s, "'continue' not supported inside 'try' clause") +s = '''\ +while 1: + try: + continue + finally: + pass +''' +ckmsg(s, "'continue' not supported inside 'try' clause") +s = '''\ +while 1: + try: + if 1: + continue + finally: + pass +''' +ckmsg(s, "'continue' not supported inside 'try' clause") +s = '''\ +try: + continue +except: + pass +''' +ckmsg(s, "'continue' not properly in loop") +ckmsg("continue\n", "'continue' not properly in loop") + r(IndentationError) r(TabError) |