Skip to content

Commit 2a23497

Browse files
committed
Tests: added extensive syntax tests.
1 parent 5e485c3 commit 2a23497

15 files changed

+6723
-192
lines changed

tests/syntax_test_atoms.ex

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
# SYNTAX TEST "Elixir.sublime-syntax"
2+
3+
## Atoms
4+
5+
atom_key: :atom_sym
6+
# ^^^^^^^^^ constant.other.symbol
7+
# ^ punctuation.definition.constant.begin
8+
# ^ punctuation.definition.constant
9+
#^^^^^^^^^ constant.other.keyword
10+
11+
a::b
12+
# ^ -constant.other.symbol
13+
# ^^ keyword.operator.colon
14+
#^ -constant.other.keyword
15+
16+
^:"a"
17+
# ^^^^ constant.other.symbol
18+
#^ keyword.operator.pin
19+
^:'a'
20+
# ^^^^ constant.other.symbol
21+
#^ keyword.operator.pin
22+
23+
# NB: this can only fixed by using ST4's branch look-ahead feature.
24+
["abc #{"def"} ghi": :"abc #{"def"} ghi"]
25+
# ^^^^^^^^ meta.interpolation.elixir
26+
# ^^^^^^^^ meta.interpolation.elixir
27+
#^^^^^
28+
29+
[a@?: :a@?]
30+
# ^^^^ constant.other.symbol
31+
#^^^^ constant.other.keyword
32+
[a?@: :a?@]
33+
# ^ keyword.operator.attribute
34+
# ^^^ constant.other.symbol
35+
# ^^ constant.other.keyword
36+
#^^ variable.function
37+
38+
Module?
39+
# ^ invalid.illegal.character-literal
40+
#^^^^^^ constant.other.module
41+
Module?.Module!
42+
# ^ keyword.operator.logical
43+
# ^^^^^^ constant.other.module
44+
# ^^ constant.numeric.char
45+
#^^^^^^ constant.other.module
46+
Module!: :Module!
47+
# ^^^^^^^^ constant.other.symbol
48+
#^^^^^^^^ constant.other.keyword
49+
Module?: :Module?
50+
# ^^^^^^^^ constant.other.symbol
51+
#^^^^^^^^ constant.other.keyword
52+
Module@node1!: :Module@node1!
53+
# ^^^^^^^^^^^^^^ constant.other.symbol
54+
#^^^^^^^^^^^^^^ constant.other.keyword
55+
Module@node1?: :Module@node1?
56+
# ^^^^^^^^^^^^^^ constant.other.symbol
57+
#^^^^^^^^^^^^^^ constant.other.keyword
58+
Module?@node1: :Module?@node1
59+
# ^^^^^ variable.other.constant
60+
# ^ keyword.operator.attribute
61+
# ^^^^^^^^ constant.other.symbol
62+
# ^^^^^^ constant.other.keyword
63+
# ^^ constant.numeric.char
64+
#^^^^^^ constant.other.module
65+
66+
### Atoms as keywords and equivalent symbols.
67+
68+
[
69+
"": :"", "\\": :"\\", "\"": :"\"", "a \#{:b} c\":": :"a \#{:b} c\":", "a#{'b'}c": :"a#{"b"}c",
70+
# ^^ constant.other.symbol
71+
# ^^^^^^ meta.interpolation.elixir
72+
# ^^^ constant.other.symbol
73+
# ^^^ constant.other.keyword
74+
# ^^^^^^ meta.interpolation.elixir
75+
# ^^ constant.other.keyword
76+
# ^^^^^^^^^^^^^^^^ constant.other.symbol
77+
# ^^^^^^^^^^^^^^^^ constant.other.keyword
78+
# ^^^^^ constant.other.symbol
79+
# ^^^^^ constant.other.keyword
80+
# ^^^^^ constant.other.symbol
81+
# ^^^^^ constant.other.keyword
82+
# ^^^ constant.other.symbol
83+
# ^^^ constant.other.keyword
84+
'': :'', '\\': :'\\', '\'': :'\'', 'a \#{:b} c\':': :'a \#{:b} c\':', 'a#{"b"}c': :'a#{'b'}c',
85+
# ^^ constant.other.symbol
86+
# ^^^^^^ meta.interpolation.elixir
87+
# ^^^ constant.other.symbol
88+
# ^^^ constant.other.keyword
89+
# ^^^^^^ meta.interpolation.elixir
90+
# ^^ constant.other.keyword
91+
# ^^^^^^^^^^^^^^^^ constant.other.symbol
92+
# ^^^^^^^^^^^^^^^^ constant.other.keyword
93+
# ^^^^^ constant.other.symbol
94+
# ^^^^^ constant.other.keyword
95+
# ^^^^^ constant.other.symbol
96+
# ^^^^^ constant.other.keyword
97+
# ^^^ constant.other.symbol
98+
# ^^^ constant.other.keyword
99+
Enum: :Enum, Kö: :Kö, Ö: , ö: , Ä@: :Ä@, me@home@work: :me@home@work,
100+
# ^^^^^^^^^^^^^ constant.other.symbol
101+
# ^^^^^^^^^^^^^ constant.other.keyword
102+
# ^^^ constant.other.symbol
103+
# ^^^ constant.other.keyword
104+
# ^^ constant.other.symbol
105+
# ^^ constant.other.keyword
106+
# ^^ constant.other.symbol
107+
# ^^ constant.other.keyword
108+
# ^^^ constant.other.symbol
109+
# ^^^ constant.other.keyword
110+
# ^^^^^ constant.other.symbol
111+
# ^^^^^ constant.other.keyword
112+
=~: :=~, =: :=, ==: :==, ===: :===, !: :!, !=: :!=, !==: :!==,
113+
# ^^^^ constant.other.symbol
114+
# ^^^^ constant.other.keyword
115+
# ^^^ constant.other.symbol
116+
# ^^^ constant.other.keyword
117+
# ^^ constant.other.symbol
118+
# ^^ constant.other.keyword
119+
# ^^^^ constant.other.symbol
120+
# ^^^^ constant.other.keyword
121+
# ^^^ constant.other.symbol
122+
# ^^^ constant.other.keyword
123+
# ^^ constant.other.symbol
124+
# ^^ constant.other.keyword
125+
# ^^^ constant.other.symbol
126+
# ^^^ constant.other.keyword
127+
<<<: :<<<, >>>: :>>>, ~~~: :~~~, <~>: :<~>, <~: :<~, <<~: :<<~, ~>: :~>,
128+
# ^^^ constant.other.symbol
129+
# ^^^ constant.other.keyword
130+
# ^^^^ constant.other.symbol
131+
# ^^^^ constant.other.keyword
132+
# ^^^ constant.other.symbol
133+
# ^^^ constant.other.keyword
134+
# ^^^^ constant.other.symbol
135+
# ^^^^ constant.other.keyword
136+
# ^^^^ constant.other.symbol
137+
# ^^^^ constant.other.keyword
138+
# ^^^^ constant.other.symbol
139+
# ^^^^ constant.other.keyword
140+
# ^^^^ constant.other.symbol
141+
# ^^^^ constant.other.keyword
142+
~>>: :~>>, |>: :|>, <|>: :<|>, /: :/, //: ://, \\: :\\, *: :*, ..: :.., ...: :...,
143+
# ^^^^ constant.other.symbol
144+
# ^^^^ constant.other.keyword
145+
# ^^^ constant.other.symbol
146+
# ^^^ constant.other.keyword
147+
# ^^ constant.other.symbol
148+
# ^^ constant.other.keyword
149+
# ^^^ constant.other.symbol
150+
# ^^^ constant.other.keyword
151+
# ^^^ constant.other.symbol
152+
# ^^^ constant.other.keyword
153+
# ^^ constant.other.symbol
154+
# ^^ constant.other.keyword
155+
# ^^^^ constant.other.symbol
156+
# ^^^^ constant.other.keyword
157+
# ^^^ constant.other.symbol
158+
# ^^^ constant.other.keyword
159+
# ^^^^ constant.other.symbol
160+
# ^^^^ constant.other.keyword
161+
>=: :>=, <=: :<=, <: :<, <-: :<-, <>: :<>, ->: :->, >: :>,
162+
# ^^ constant.other.symbol
163+
# ^^ constant.other.keyword
164+
# ^^^ constant.other.symbol
165+
# ^^^ constant.other.keyword
166+
# ^^^ constant.other.symbol
167+
# ^^^ constant.other.keyword
168+
# ^^^ constant.other.symbol
169+
# ^^^ constant.other.keyword
170+
# ^^ constant.other.symbol
171+
# ^^ constant.other.keyword
172+
# ^^^ constant.other.symbol
173+
# ^^^ constant.other.keyword
174+
# ^^^ constant.other.symbol
175+
# ^^^ constant.other.keyword
176+
-: :-, --: :--, ---: :---, +: :+, ++: :++, +++: :+++,
177+
# ^^^^ constant.other.symbol
178+
# ^^^^ constant.other.keyword
179+
# ^^^ constant.other.symbol
180+
# ^^^ constant.other.keyword
181+
# ^^ constant.other.symbol
182+
# ^^ constant.other.keyword
183+
# ^^^^ constant.other.symbol
184+
# ^^^^ constant.other.keyword
185+
# ^^^ constant.other.symbol
186+
# ^^^ constant.other.keyword
187+
# ^^ constant.other.symbol
188+
# ^^ constant.other.keyword
189+
&: :&, &&: :&&, &&&: :&&&, |: :|, ||: :||, |||: :|||, @: :@,
190+
# ^^ constant.other.symbol
191+
# ^^ constant.other.keyword
192+
# ^^^^ constant.other.symbol
193+
# ^^^^ constant.other.keyword
194+
# ^^^ constant.other.symbol
195+
# ^^^ constant.other.keyword
196+
# ^^ constant.other.symbol
197+
# ^^ constant.other.keyword
198+
# ^^^^ constant.other.symbol
199+
# ^^^^ constant.other.keyword
200+
# ^^^ constant.other.symbol
201+
# ^^^ constant.other.keyword
202+
# ^^ constant.other.symbol
203+
# ^^ constant.other.keyword
204+
^: :^, ^^^: :^^^, "::": :::,
205+
# ^^^ constant.other.symbol
206+
# ^^^^^ constant.other.keyword
207+
# ^^^^ constant.other.symbol
208+
# ^^^^ constant.other.keyword
209+
# ^^ constant.other.symbol
210+
# ^^ constant.other.keyword
211+
212+
# Special symbols:
213+
<<>>: :<<>>, ..//: :..//, {}: :{}, %{}: :%{}, %: :%
214+
# ^^ constant.other.symbol
215+
# ^^ constant.other.keyword
216+
# ^^^^ constant.other.symbol
217+
# ^^^ constant.other.keyword
218+
# ^^^ constant.other.symbol
219+
# ^^^ constant.other.keyword
220+
# ^^^^^ constant.other.symbol
221+
# ^^^^^ constant.other.keyword
222+
# ^^^^^ constant.other.symbol
223+
# ^^^^^ constant.other.keyword
224+
]
225+
226+
227+
### Special form variables
228+
229+
[
230+
__MODULE__: :__MODULE__, __ENV__: :__ENV__, __DIR__: :__DIR__,
231+
# ^^^^^^^^ constant.other.symbol
232+
# ^^^^^^^^ constant.other.keyword
233+
# ^^^^^^^^ constant.other.symbol
234+
# ^^^^^^^^ constant.other.keyword
235+
# ^^^^^^^^^^^ constant.other.symbol
236+
# ^^^^^^^^^^^ constant.other.keyword
237+
__CALLER__: :__CALLER__, __STACKTRACE__: :__STACKTRACE__,
238+
# ^^^^^^^^^^^^^^^ constant.other.symbol
239+
# ^^^^^^^^^^^^^^^ constant.other.keyword
240+
# ^^^^^^^^^^^ constant.other.symbol
241+
# ^^^^^^^^^^^ constant.other.keyword
242+
]
243+
244+
245+
### Atom symbol exceptions:
246+
247+
[
248+
?: :?,
249+
# ^^ constant.numeric
250+
# ^ -constant.other.symbol
251+
# ^ constant.other.symbol
252+
# ^^ constant.numeric -constant.other.keyword
253+
:::,
254+
# ^ punctuation.separator.sequence
255+
# ^^^ constant.other.symbol
256+
:: ::,
257+
# ^^ keyword.operator.colon
258+
# ^^ keyword.operator.colon
259+
**: :**,
260+
# ^ keyword.operator.arithmetic
261+
# ^^ constant.other.symbol
262+
# ^^ constant.other.keyword
263+
# ^ -constant.other.keyword
264+
.: :.,
265+
# ^^ constant.other.symbol
266+
# ^ punctuation.accessor.dot
267+
# ^^ -constant.other.keyword
268+
^^: :^^,
269+
# ^ keyword.operator.pin
270+
# ^^ constant.other.symbol
271+
# ^^ constant.other.keyword
272+
# ^ -constant.other.keyword
273+
[]: :[],
274+
# ^^ -constant.other.symbol
275+
# ^ constant.other.symbol
276+
# ^ constant.other.symbol
277+
# ^^ -constant.other.keyword
278+
"[]": :"[]",
279+
# ^^^^^ constant.other.symbol
280+
# ^^^^^ constant.other.keyword
281+
]

0 commit comments

Comments
 (0)