File: test-triple-strings.py

package info (click to toggle)
python-mode 1%3A6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,440 kB
  • ctags: 3,272
  • sloc: lisp: 32,583; sh: 1,418; python: 757; makefile: 41
file content (78 lines) | stat: -rw-r--r-- 1,648 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Source:
# http://launchpadlibrarian.net/22565844/test-triple-strings.py
# Author: Ed Loper

# This file tests python-mode's ability to handle triple-quoted
# string.  Here's how to tell if python-mode's doing the right thing:
#
# - All dashes (-) should *not* be marked as strings.
# - All Os, Xs, <s, and >s should be marked as strings.
# - None of the quote marks around O's should be marked as strings.
# - Quote marks that are between angle brackets (<...>) should be
#   marked as strings.  Think of "X" as a pair of angle brackets
#   right next to one another.  Also, quotes to the left of >s
#   and the right of <s should be marked as strings.
#
# (note: replacing -,O,X,<,> with other characters should not affect
# the fontificatin any; these characters were just used to make it
# easier to see what the intended colorization is.)

# Some easy cases:
"O" 'O' "<'>" '<">'
 "O"   'O'   "<'>"   '<">'
 " O "   ' O '   " < ' > "   ' < " > '
"""O""" '''O''' "<<<'>>>" '''<">'''

# Some harder cases:
"""<">""" '''<'>'''

# Some tricky cases with backslashes.
'''<'>''' '''<\'''>''' '''<\\'''

# Some tricky cases with more than 3 quotes in a row.
"O""" "O"
"""">"""
"""">>"""
""""X">"""
""""X"">"""
"""O""""O" ""
"""O""""" "O"
"""O""""""<">"""
"""O"""""""X">"""
"""O""""""""X">"""
"""O""" "<<<>>>>"
"""""""""O""" "O"
"""O""""O""O""O"""
"""">"""    """">>"""    """">>>"""
""""">"""   """"">>"""   """"">>>"""
""""">>>""""O"   """"">>>"""""
"""""""""<""X"X"">"""

# One version had a bug with comments ending in string markers: "
"""O"""

 "" ""

"""<">""" '''<'>'''

# Spanning multiple lines:

"<
>"

'<
>'

"""
<
<
<
<
'
X
X
X
"
>
>
"""