tangled
alpha
login
or
join now
gearsco.de
/
pearl
2
fork
atom
An Erlang lexer and syntax highlighter in Gleam
2
fork
atom
overview
issues
pulls
pipelines
Add roundtrip tests
gearsco.de
7 months ago
742b426a
51d69e8b
+98
2 changed files
expand all
collapse all
unified
split
test
pearl_test.gleam
tokens.txt
+12
test/pearl_test.gleam
···
33
33
assert found_errors == errors
34
34
}
35
35
36
36
+
pub fn stdlib_ffi_roundtrip_test() {
37
37
+
let assert Ok(stdlib_ffi_file) =
38
38
+
simplifile.read("build/packages/gleam_stdlib/src/gleam_stdlib.erl")
39
39
+
40
40
+
assert_roundtrip(stdlib_ffi_file, False)
41
41
+
}
42
42
+
43
43
+
pub fn tokens_roundtrip_test() {
44
44
+
let assert Ok(tokens_file) = simplifile.read("test/tokens.txt")
45
45
+
assert_roundtrip(tokens_file, False)
46
46
+
}
47
47
+
36
48
pub fn unknown_character_test() {
37
49
let src = "a&b"
38
50
assert_errors(src, [pearl.UnknownCharacter("&")])
+86
test/tokens.txt
···
1
1
+
% some kind of comment
2
2
+
%% doc comment
3
3
+
%%%mod comment
4
4
+
5
5
+
$a
6
6
+
1323 123_456_789 16#abc_def_138 2#101_101
7
7
+
1.3 1.2e3_0
8
8
+
hello@world 'Atom with? special-characters!'
9
9
+
"A string!"
10
10
+
"This one
11
11
+
spans multiple
12
12
+
13
13
+
lines!"
14
14
+
~/I need "quotes"/ ~<This is also possible> ~b"Bit array"
15
15
+
Variable Something_else@5
16
16
+
17
17
+
after
18
18
+
begin
19
19
+
case
20
20
+
catch
21
21
+
cond
22
22
+
else
23
23
+
end
24
24
+
fun
25
25
+
if
26
26
+
let
27
27
+
maybe
28
28
+
of
29
29
+
receive
30
30
+
try
31
31
+
when
32
32
+
(
33
33
+
)
34
34
+
{
35
35
+
}
36
36
+
[
37
37
+
]
38
38
+
,
39
39
+
;
40
40
+
:
41
41
+
.
42
42
+
->
43
43
+
<<
44
44
+
>>
45
45
+
#
46
46
+
::
47
47
+
..
48
48
+
...
49
49
+
||
50
50
+
=>
51
51
+
:=
52
52
+
<-
53
53
+
<=
54
54
+
|
55
55
+
==
56
56
+
/=
57
57
+
=<
58
58
+
<
59
59
+
>=
60
60
+
>
61
61
+
=:=
62
62
+
=/=
63
63
+
+
64
64
+
-
65
65
+
*
66
66
+
/
67
67
+
bnot
68
68
+
div
69
69
+
rem
70
70
+
band
71
71
+
bor
72
72
+
bxor
73
73
+
bsl
74
74
+
bsr
75
75
+
not
76
76
+
and
77
77
+
or
78
78
+
xor
79
79
+
andalso
80
80
+
orelse
81
81
+
++
82
82
+
--
83
83
+
?=
84
84
+
?
85
85
+
!
86
86
+
=