add: Variable declaration tests.

This commit is contained in:
2024-08-17 11:37:41 +08:00
parent ed36546b30
commit eedbd5e7e5
3 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
using CanonSharp.Pascal.Parser;
using CanonSharp.Pascal.SyntaxTree;
using CanonSharp.Tests.Utils;
namespace CanonSharp.Tests.ParserTests;
public class VariableDeclarationTests : GrammarParserTestBase
{
[Theory]
[InlineData("boolean", "boolean")]
[InlineData("integer", "integer")]
[InlineData("char", "char")]
[InlineData("real", "real")]
public void TypeParseTest(string input, string value)
{
TypeNode node = RunParser<TypeNode>(GrammarParser.TypeParser(), input);
Assert.Equal(value, node.TypeToken.LiteralValue);
}
}