From d6ecb42d083c322f342d7556eaca067935824a90 Mon Sep 17 00:00:00 2001 From: Kevin Thompson Date: Thu, 30 May 2024 22:27:42 -0700 Subject: [PATCH] test: add additional test for lexing block comments --- .../CodeAnalysis/Syntax/LexerTests.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/Panther.Tests/CodeAnalysis/Syntax/LexerTests.cs b/tests/Panther.Tests/CodeAnalysis/Syntax/LexerTests.cs index 188efee..9f10f5a 100644 --- a/tests/Panther.Tests/CodeAnalysis/Syntax/LexerTests.cs +++ b/tests/Panther.Tests/CodeAnalysis/Syntax/LexerTests.cs @@ -114,4 +114,37 @@ public void CanLexComment(LineCommentTriviaData lineCommentTrivia) } ); } + + [Property] + public void CanLexBlockComment() + { + var text = AnnotatedText + .Parse( + $@" + /* + 1 + */ + 6" + ) + .Text; + var tokens = SyntaxTree.ParseTokens(text); + + Assert.Collection( + tokens, + token1 => + { + Assert.NotNull(token1); + Assert.Collection( + token1.LeadingTrivia, + trivia => + { + Assert.Equal(SyntaxKind.BlockCommentTrivia, trivia.Kind); + }, + trivia => { } + ); + Assert.Equal(SyntaxKind.NumberToken, token1.Kind); + Assert.Equal("6", token1.Text); + } + ); + } }