|
1 """Test file for syntax highlighting of editors. |
|
2 |
|
3 Meant to cover a wide range of different types of statements and expressions. |
|
4 Not necessarily sensical or comprehensive (assume that if one exception is |
|
5 highlighted that all are, for instance). |
|
6 |
|
7 Extraneous trailing whitespace can't be tested because of svn pre-commit hook |
|
8 checks for such things. |
|
9 |
|
10 """ |
|
11 # Comment |
|
12 # OPTIONAL: XXX catch your attention |
|
13 |
|
14 # Statements |
|
15 from __future__ import with_statement # Import |
|
16 from sys import path as thing |
|
17 assert True # keyword |
|
18 def foo(): # function definition |
|
19 return [] |
|
20 class Bar(object): # Class definition |
|
21 def __enter__(self): |
|
22 pass |
|
23 def __exit__(self, *args): |
|
24 pass |
|
25 foo() # UNCOLOURED: function call |
|
26 while False: # 'while' |
|
27 continue |
|
28 for x in foo(): # 'for' |
|
29 break |
|
30 with Bar() as stuff: |
|
31 pass |
|
32 if False: pass # 'if' |
|
33 elif False: pass |
|
34 else: pass |
|
35 |
|
36 # Constants |
|
37 'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted |
|
38 "double-quote" |
|
39 """triple double-quote""" |
|
40 '''triple single-quote''' |
|
41 r'raw' |
|
42 ur'unicode raw' |
|
43 'escape\n' |
|
44 '\04' # octal |
|
45 '\xFF' # hex |
|
46 '\u1111' # unicode character |
|
47 1 # Integral |
|
48 1L |
|
49 1.0 # Float |
|
50 .1 |
|
51 1+2j # Complex |
|
52 |
|
53 # Expressions |
|
54 1 and 2 or 3 # Boolean operators |
|
55 2 < 3 # UNCOLOURED: comparison operators |
|
56 spam = 42 # UNCOLOURED: assignment |
|
57 2 + 3 # UNCOLOURED: number operators |
|
58 [] # UNCOLOURED: list |
|
59 {} # UNCOLOURED: dict |
|
60 (1,) # UNCOLOURED: tuple |
|
61 all # Built-in functions |
|
62 GeneratorExit # Exceptions |