fe35288cb5
Co-authored-by: jackfiled <xcrenchangjun@outlook.com> Reviewed-on: PostGuard/Canon#12 Co-authored-by: Huaps <1183155719@qq.com> Co-committed-by: Huaps <1183155719@qq.com>
28 lines
990 B
C#
28 lines
990 B
C#
using Canon.Core.Enums;
|
|
using Canon.Core.LexicalParser;
|
|
|
|
namespace Canon.Tests.LexicalParserTests;
|
|
|
|
public class DelimiterTests
|
|
{
|
|
[Theory]
|
|
[InlineData(",123", DelimiterType.Comma)]
|
|
[InlineData(".123", DelimiterType.Period)]
|
|
[InlineData(":123", DelimiterType.Colon)]
|
|
[InlineData(";123", DelimiterType.Semicolon)]
|
|
[InlineData("(123)", DelimiterType.LeftParenthesis)]
|
|
[InlineData(").", DelimiterType.RightParenthesis)]
|
|
[InlineData("[asd", DelimiterType.LeftSquareBracket)]
|
|
[InlineData("]asd", DelimiterType.RightSquareBracket)]
|
|
public void SmokeTest(string input, DelimiterType type)
|
|
{
|
|
Lexer lexer = new(input);
|
|
List<SemanticToken> tokens = lexer.Tokenize();
|
|
|
|
SemanticToken token = tokens[0];
|
|
Assert.Equal(SemanticTokenType.Delimiter, token.TokenType);
|
|
DelimiterSemanticToken delimiterSemanticToken = (DelimiterSemanticToken)token;
|
|
Assert.Equal(type, delimiterSemanticToken.DelimiterType);
|
|
}
|
|
}
|