Skip to content

Commit 7357885

Browse files
committed
Add highlighting tests
1 parent 3012809 commit 7357885

File tree

8 files changed

+1096
-0
lines changed

8 files changed

+1096
-0
lines changed

test/highlight/anonymous.ex

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
fn x, y, z ->
2+
# <- keyword
3+
# ^ variable
4+
# ^ punctuation.delimiter
5+
# ^ variable
6+
# ^ punctuation.delimiter
7+
# ^ variable
8+
# ^ operator
9+
fn(a, b, c) ->
10+
# <- keyword
11+
# ^ punctuation.bracket
12+
# ^ variable
13+
# ^ punctuation.delimiter
14+
# ^ variable
15+
# ^ punctuation.delimiter
16+
# ^ variable
17+
# ^ punctuation.bracket
18+
# ^ operator
19+
&(x + y - z * a / &1 + b + div(&2, c))
20+
#<- operator
21+
#^ punctuation.bracket
22+
# ^ variable
23+
# ^ operator
24+
# ^ variable
25+
# ^ operator
26+
# ^ variable
27+
# ^ operator
28+
# ^ variable
29+
# ^ operator
30+
# ^ operator
31+
# ^ operator
32+
# ^ variable
33+
# ^ operator
34+
# ^ function
35+
# ^ punctuation.bracket
36+
# ^ operator
37+
# ^ punctuation.delimiter
38+
# ^ variable
39+
# ^ punctuation.bracket
40+
# ^ punctuation.bracket
41+
end
42+
end
43+
44+
&Set.put(&1, &2)
45+
# <- operator
46+
# ^ type
47+
# ^ operator
48+
# ^ function
49+
# ^ punctuation.bracket
50+
# ^ operator
51+
# ^ punctuation.delimiter
52+
# ^ operator
53+
# ^ punctuation.bracket
54+
55+
&( Set.put(&1, &1) )
56+
#<- operator
57+
#^ punctuation.bracket
58+
# ^ type
59+
# ^ operator
60+
# ^ function
61+
# ^ punctuation.bracket
62+
# ^ operator
63+
# ^ punctuation.delimiter
64+
# ^ operator
65+
# ^ punctuation.bracket
66+
# ^ punctuation.bracket

test/highlight/calls.ex

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Path.expand("..", __DIR__)
2+
# ^ type
3+
# ^ operator
4+
# ^ function
5+
# ^ punctuation.bracket
6+
# ^ string
7+
# ^ punctuation.delimiter
8+
# ^ constant.builtin
9+
# ^ punctuation.bracket
10+
11+
func.(1)
12+
# ^ variable
13+
# ^ operator
14+
# ^ punctuation.bracket
15+
# ^ number
16+
# ^ punctuation.bracket
17+
18+
arg |> func
19+
# ^ variable
20+
# ^ operator
21+
# ^ function
22+
23+
func 1
24+
# ^ function
25+
# ^ number
26+
27+
hd([1,2])
28+
# <- function
29+
# ^ punctuation.bracket
30+
# ^ punctuation.bracket
31+
# ^ number
32+
# ^ punctuation.delimiter
33+
# ^ number
34+
# ^ punctuation.bracket
35+
# ^ punctuation.bracket
36+
37+
Kernel.spawn(fn -> :ok end)
38+
# ^ type
39+
# ^ operator
40+
# ^ function
41+
# ^ punctuation.bracket
42+
# ^ keyword
43+
# ^ operator
44+
# ^ string.special.symbol
45+
# ^ keyword
46+
# ^ punctuation.bracket
47+
48+
IO.ANSI.black
49+
# ^ type
50+
# ^ operator
51+
# ^ function
52+
53+
Kernel.-(number)
54+
# ^ type
55+
# ^ operator
56+
# ^ operator
57+
# ^ punctuation.bracket
58+
# ^ variable
59+
# ^ punctuation.bracket
60+
61+
Enum.map([1, 2], fn x ->
62+
# ^ type
63+
# ^ operator
64+
# ^ function
65+
# ^ punctuation.bracket
66+
# ^ punctuation.bracket
67+
# ^ number
68+
# ^ punctuation.delimiter
69+
# ^ number
70+
# ^ punctuation.bracket
71+
# ^ punctuation.delimiter
72+
# ^ keyword
73+
# ^ variable
74+
# ^ operator
75+
x * 2
76+
# <- variable
77+
# ^ operator
78+
# ^ number
79+
end)
80+
# <- keyword
81+
# ^ punctuation.bracket

test/highlight/data_structures.ex

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
<<1, 2, 3>>
2+
# <- punctuation.bracket
3+
# ^ number
4+
# ^ punctuation.delimiter
5+
# ^ number
6+
# ^ punctuation.delimiter
7+
# ^ number
8+
# ^ punctuation.bracket
9+
10+
<< header :: size(8), data :: binary >>
11+
# <- punctuation.bracket
12+
# ^ variable
13+
# ^ operator
14+
# ^ function
15+
# ^ punctuation.bracket
16+
# ^ number
17+
# ^ punctuation.bracket
18+
# ^ punctuation.delimiter
19+
# ^ variable
20+
# ^ operator
21+
# ^ variable
22+
# ^ punctuation.bracket
23+
24+
<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "hello™1"
25+
# <- punctuation.bracket
26+
# ^ string
27+
# ^ operator
28+
# ^ variable
29+
# ^ punctuation.delimiter
30+
# ^ variable
31+
# ^ operator
32+
# ^ variable
33+
# ^ punctuation.delimiter
34+
# ^ variable
35+
# ^ operator
36+
# ^ punctuation.bracket
37+
# ^ number
38+
# ^ punctuation.delimiter
39+
# ^ function
40+
# ^ punctuation.bracket
41+
# ^ number
42+
# ^ punctuation.bracket
43+
# ^ punctuation.bracket
44+
# ^ punctuation.bracket
45+
# ^ operator
46+
# ^ string
47+
48+
[1, :a, 'hello'] ++ [2, 3]
49+
# <- punctuation.bracket
50+
# ^ punctuation.delimiter
51+
# ^ string.special.symbol
52+
# ^ punctuation.delimiter
53+
# ^ string
54+
# ^ punctuation.bracket
55+
# ^ operator
56+
# ^ punctuation.bracket
57+
# ^ number
58+
# ^ punctuation.delimiter
59+
# ^ number
60+
# ^ punctuation.bracket
61+
62+
[:head | [?t, ?a]]
63+
# <- punctuation.bracket
64+
# ^ string.special.symbol
65+
# ^ operator
66+
# ^ punctuation.bracket
67+
# ^ constant
68+
# ^ punctuation.delimiter
69+
# ^ constant
70+
# ^ punctuation.bracket
71+
# ^ punctuation.bracket
72+
73+
{:one, 2.0, "three"}
74+
# <- punctuation.bracket
75+
# ^ string.special.symbol
76+
# ^ punctuation.delimiter
77+
# ^ number
78+
# ^ punctuation.delimiter
79+
# ^ string
80+
# ^ punctuation.bracket
81+
82+
[option: "value", key: :word]
83+
# <- punctuation.bracket
84+
# ^ string.special.symbol
85+
# ^ string
86+
# ^ punctuation.delimiter
87+
# ^ string.special.symbol
88+
# ^ string.special.symbol
89+
# ^ punctuation.bracket
90+
91+
[++: "operator", ~~~: :&&&]
92+
# <- punctuation.bracket
93+
# ^ string.special.symbol
94+
# ^ string
95+
# ^ punctuation.delimiter
96+
# ^ string.special.symbol
97+
# ^ string.special.symbol
98+
# ^ punctuation.bracket
99+
100+
[...: 1, <<>>: 2, %{}: 3, %: 4, {}: 5]
101+
# <- punctuation.bracket
102+
# ^ string.special.symbol
103+
# ^ number
104+
# ^ punctuation.delimiter
105+
# ^ string.special.symbol
106+
# ^ number
107+
# ^ punctuation.delimiter
108+
# ^ string.special.symbol
109+
# ^ number
110+
# ^ punctuation.delimiter
111+
# ^ string.special.symbol
112+
# ^ number
113+
# ^ punctuation.delimiter
114+
# ^ string.special.symbol
115+
# ^ number
116+
# ^ punctuation.bracket
117+
118+
["this is an atom too": 1, "so is #{1} this": 2]
119+
# <- punctuation.bracket
120+
# ^ string.special.symbol
121+
# ^ number
122+
# ^ punctuation.delimiter
123+
# ^ string.special.symbol
124+
# ^ punctuation.special
125+
# ^ number
126+
# ^ punctuation.special
127+
# ^ number
128+
# ^ punctuation.bracket
129+
130+
%{shortcut: "syntax"}
131+
#<- punctuation
132+
#^ punctuation.bracket
133+
# ^ string.special.symbol
134+
# ^ string
135+
# ^ punctuation.bracket
136+
137+
%{map | "update" => "me"}
138+
#<- punctuation
139+
#^ punctuation.bracket
140+
# ^ variable
141+
# ^ operator
142+
# ^ string
143+
# ^ operator
144+
# ^ string
145+
# ^ punctuation.bracket
146+
147+
%{ 12 => 13, :weird => ['thing'] }
148+
#<- punctuation
149+
#^ punctuation.bracket
150+
# ^ number
151+
# ^ operator
152+
# ^ number
153+
# ^ punctuation.delimiter
154+
# ^ string.special.symbol
155+
# ^ operator
156+
# ^ punctuation.bracket
157+
# ^ string
158+
# ^ punctuation.bracket
159+
# ^ punctuation.bracket
160+
161+
%Long.Module.Name{name: "Silly"}
162+
# <- punctuation
163+
# ^ type
164+
# ^ type
165+
# ^ punctuation.bracket
166+
# ^ string.special.symbol
167+
# ^ string
168+
# ^ punctuation.bracket
169+
170+
%Long.Module.Name{s | height: {192, :cm}}
171+
# <- punctuation
172+
# ^ type
173+
# ^ punctuation.bracket
174+
# ^ variable
175+
# ^ operator
176+
# ^ string.special.symbol
177+
# ^ punctuation.bracket
178+
# ^ number
179+
# ^ punctuation.delimiter
180+
# ^ string.special.symbol
181+
# ^ punctuation.bracket
182+
# ^ punctuation.bracket
183+
184+
".. #{%Long.Module.Name{s | height: {192, :cm}}} .."
185+
# ^ string
186+
# ^ punctuation.special
187+
# ^ punctuation
188+
# ^ type
189+
# ^ punctuation.bracket
190+
# ^ variable
191+
# ^ operator
192+
# ^ string.special.symbol
193+
# ^ punctuation.bracket
194+
# ^ number
195+
# ^ punctuation.delimiter
196+
# ^ string.special.symbol
197+
# ^ punctuation.bracket
198+
# ^ punctuation.bracket
199+
# ^ punctuation.special
200+
# ^ string

test/highlight/identifiers.ex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
abc_123
2+
# ^ variable
3+
4+
_018OP
5+
# ^ comment.unused
6+
7+
A__0
8+
# ^ type
9+
10+
__MODULE__ ; __STACKTRACE__
11+
# ^ constant.builtin
12+
# ^ constant.builtin
13+
14+
__OTHER__
15+
# ^ comment.unused

0 commit comments

Comments
 (0)