]> git.madduck.net Git - etc/vim.git/blob - test/syntax.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Highlight angle braced hyperlinks.
[etc/vim.git] / test / syntax.vader
1 Given mkd (bold);
2 **bold** not bold
3
4 Execute (SyntaxOf(pattern)):
5   AssertEqual SyntaxOf('b'), 'htmlBold'
6
7 Given mkd (italic);
8 *italic*
9
10 Execute (SyntaxOf(pattern)):
11   AssertEqual SyntaxOf('i'), 'htmlItalic'
12
13 # Links
14
15 Given mkd;
16 [a](b)
17
18 Execute (link with title):
19   AssertEqual SyntaxOf('a'), 'mkdLink'
20   AssertEqual SyntaxOf('b'), 'mkdURL'
21
22 Given mkd;
23 (a)
24
25 Execute (parenthesis not in link):
26   AssertNotEqual SyntaxOf('a'), 'mkdLink'
27
28 Given mkd;
29 [a](b) c [d](e)
30
31 Execute (multiple links on a line):
32   AssertEqual SyntaxOf('c'), ''
33
34 # Autolinks
35
36 Given mkd;
37 a <http://b> c
38
39 Execute (autolink):
40   AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
41   AssertEqual SyntaxOf('<'), 'mkdDelimiter'
42   AssertEqual SyntaxOf('b'), 'mkdInlineURL'
43   AssertEqual SyntaxOf('>'), 'mkdDelimiter'
44   AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
45
46 Given mkd;
47 <HtTp://a>
48
49 Execute (autolink with scheme case is insensitive):
50   AssertEqual SyntaxOf('a'), 'mkdInlineURL'
51
52 Given mkd;
53 <notascheme://a>
54
55 Execute (autolink without known scheme is not a link):
56   AssertNotEqual SyntaxOf('n'), 'mkdInlineURL'
57
58 Given mkd;
59 <a>
60
61 Execute (autolink without scheme is not a link):
62   AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
63
64 Given mkd;
65 < http://a >
66 <http://b c>
67 <http://d
68 e>
69
70 Execute (autolink with space is not a link):
71   AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
72   AssertNotEqual SyntaxOf('b'), 'mkdInlineURL'
73   AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
74   AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
75   AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
76
77 Given mkd;
78 \<http://a>
79
80 Execute (autolinks can be backslash escaped):
81   AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'
82
83 # Math
84
85 Given mkd;
86 a $x$ b
87 c $$y$$ d
88 \$e\$
89 \$\$f\$\$
90
91 Execute (math):
92   AssertNotEqual SyntaxOf('x'), 'mkdMath'
93   AssertNotEqual SyntaxOf('y'), 'mkdMath'
94   let g:vim_markdown_math=1
95   syn off | syn on
96   AssertNotEqual SyntaxOf('a'), 'mkdMath'
97   AssertNotEqual SyntaxOf('b'), 'mkdMath'
98   AssertNotEqual SyntaxOf('c'), 'mkdMath'
99   AssertNotEqual SyntaxOf('d'), 'mkdMath'
100   AssertNotEqual SyntaxOf('e'), 'mkdMath'
101   AssertNotEqual SyntaxOf('f'), 'mkdMath'
102   AssertEqual SyntaxOf('x'), 'mkdMath'
103   AssertEqual SyntaxOf('y'), 'mkdMath'
104   let g:vim_markdown_math=0
105   syn off | syn on
106   AssertNotEqual SyntaxOf('x'), 'mkdMath'
107   AssertNotEqual SyntaxOf('y'), 'mkdMath'
108
109 Given mkd;
110 a
111
112 $
113 b
114 $
115
116 c
117
118 Execute (multiline math):
119   let g:vim_markdown_math=1
120   syn off | syn on
121   AssertNotEqual SyntaxOf('a'), 'mkdMath'
122   AssertEqual SyntaxOf('b'), 'mkdMath'
123   AssertNotEqual SyntaxOf('c'), 'mkdMath'
124
125 # YAML frontmatter
126
127 Given mkd;
128 ---
129 a: b
130 ---
131
132 Execute (YAML frontmatter is controlled by the option):
133   AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'
134   let g:vim_markdown_frontmatter=1
135   syn off | syn on
136   AssertEqual SyntaxOf('a'), 'yamlBlockMappingKey'
137   let g:vim_markdown_frontmatter=0
138   syn off | syn on
139   AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'
140
141 Given mkd;
142
143 ---
144 a: b
145 ---
146
147 Execute (YAML frontmatter only works if it's the first thing in the file):
148   let g:vim_markdown_frontmatter=1
149   syn off | syn on
150   AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'
151
152 Given mkd;
153 ---
154 a: b
155 ---
156
157 ---
158
159 Execute (rules are not mistaken by YAML frontmatter delimiters):
160   let g:vim_markdown_frontmatter=1
161   syn off | syn on
162   AssertEqual SyntaxAt(5, 1), 'mkdRule'