Skip to content

Commit 74cc11d

Browse files
committed
.
1 parent 14c955e commit 74cc11d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

compiler/test/dotty/tools/dotc/printing/SyntaxHighlightingTests.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dotty.tools.dotc.printing
22

33
import scala.language.unsafeNulls
44

5+
import dotty.shaded.fansi
56
import dotty.tools.DottyTest
67
import org.junit.Assert._
78
import org.junit.{Ignore, Test}
@@ -12,14 +13,15 @@ class SyntaxHighlightingTests extends DottyTest {
1213
import SyntaxHighlighting._
1314

1415
private def test(source: String, expected: String): Unit = {
16+
1517
val highlighted = SyntaxHighlighting.highlight(source)(using ctx.withColors)
16-
.replace(NoColor, ">")
17-
.replace(CommentColor, "<C|")
18-
.replace(KeywordColor, "<K|")
19-
.replace(ValDefColor, "<V|")
20-
.replace(LiteralColor, "<L|")
21-
.replace(StringColor, "<S|")
22-
.replace(TypeColor, "<T|")
18+
.replace(fansi.Attrs.emitAnsiCodes(fansi.Color.Red.applyMask, NoColor.applyMask), ">")
19+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, CommentColor.applyMask), "<C|")
20+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, KeywordColor.applyMask), "<K|")
21+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, ValDefColor.applyMask), "<V|")
22+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, LiteralColor.applyMask), "<L|")
23+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, StringColor.applyMask), "<S|")
24+
.replace(fansi.Attrs.emitAnsiCodes(NoColor.applyMask, TypeColor.applyMask), "<T|")
2325
// .replace(AnnotationColor, "<A|") // is the same color as type color
2426

2527
if (expected != highlighted) {

0 commit comments

Comments
 (0)