File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This file is a part of Julia. License is MIT: https://julialang.org/license
2
+
3
+ using JuliaSyntaxHighlighting: highlight, highlight!
4
+ using Test
5
+
6
+ # We could go to the effort of testing each individual highlight face,
7
+ # however here we're aiming for the much lower bar of ensuring that
8
+ # `highlight` consistently returns a reasonable result.
9
+ # This also avoids testing as much of the particulars of JuliaSyntax.
10
+
11
+ sum1to8_highlighted = Base. AnnotatedString (" sum(1:8)" , [
12
+ (1 : 3 , :face => :julia_funcall ),
13
+ (4 : 4 , :face => :julia_rainbow_paren_1 ),
14
+ (5 : 5 , :face => :julia_number ),
15
+ (6 : 6 , :face => :julia_operator ),
16
+ (7 : 7 , :face => :julia_number ),
17
+ (8 : 8 , :face => :julia_rainbow_paren_1 )
18
+ ])
19
+
20
+ @test highlight (" sum(1:8)" ) == sum1to8_highlighted
21
+ @test highlight (IOBuffer (" sum(1:8)" )) == sum1to8_highlighted
22
+ @test highlight (IOContext (IOBuffer (" sum(1:8)" ))) == sum1to8_highlighted
23
+
24
+ astr_sum1to8 = Base. AnnotatedString (" sum(1:8)" )
25
+ @test highlight! (astr_sum1to8) == sum1to8_highlighted
26
+ @test astr_sum1to8 == sum1to8_highlighted
You can’t perform that action at this time.
0 commit comments