Skip to content

Commit

Permalink
#65 split lexer unit tests into separate partial class files by token…
Browse files Browse the repository at this point in the history
… type
  • Loading branch information
mikeclayton committed Sep 10, 2020
1 parent 43acd3e commit 937ecd1
Show file tree
Hide file tree
Showing 23 changed files with 2,789 additions and 2,590 deletions.
13 changes: 7 additions & 6 deletions src/Kingsland.MofParser.UnitTests/CodeGen/MofGeneratorTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Kingsland.MofParser.CodeGen;
using Kingsland.MofParser.Lexing;
using Kingsland.MofParser.Parsing;
using Kingsland.ParseFx.Parsing;
using Kingsland.ParseFx.Text;
Expand Down Expand Up @@ -89,7 +90,7 @@ public static void QualifierWithMofV2FlavorsAndQuirksDisabledShouldThrow()
"\t[read: ToSubClass, MappingStrings{\"Win32API|AccessControl|Windows NT Privileges\"}: ToSubClass] string PrivilegesNotHeld[];\r\n" +
"\t[read: ToSubClass, MappingStrings{\"Win32API|AccessControl|Windows NT Privileges\"}: ToSubClass] string PrivilegesRequired[];\r\n" +
"};";
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
var ex = Assert.Throws<UnexpectedTokenException>(
() =>
Expand Down Expand Up @@ -172,7 +173,7 @@ public static void InvalidStructureFeatureShouldThrow()
"{\r\n" +
"\t100\r\n" +
"};";
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
Assert.AreEqual(sourceMof, tokensMof);
var ex = Assert.Throws<UnexpectedTokenException>(
Expand Down Expand Up @@ -305,7 +306,7 @@ public static void InvalidClassFeatureShouldThrow()
"{\r\n" +
"\t100\r\n" +
"};";
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
var ex = Assert.Throws<UnexpectedTokenException>(
() => {
Expand Down Expand Up @@ -473,7 +474,7 @@ public static void EnumerationDeclarationDeprecatedMof300IntegerBaseAndQuirksEna
"{\r\n" +
"\tJuly = \"July\"\r\n" +
"};";
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
var ex = Assert.Throws<UnexpectedTokenException>(
() =>
Expand Down Expand Up @@ -1390,7 +1391,7 @@ public static void EnumValueArrayWithQualifiedEnumValuesAndQuirksDisabledShouldT
"{\r\n" +
"\tMonth = {MonthEnums.July};\r\n" +
"};";
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
var ex = Assert.Throws<UnexpectedTokenException>(
() =>
Expand Down Expand Up @@ -1449,7 +1450,7 @@ public static void EnumValueArrayWithQualifiedEnumValuesAndQuirksDisabledShouldT
private static void AssertRoundtrip(string sourceMof, ParserQuirks parserQuirks = ParserQuirks.None)
{
// check the lexer tokens roundtrips ok
var tokens = Lexing.Lexer.Lex(SourceReader.From(sourceMof));
var tokens = Lexer.Lex(SourceReader.From(sourceMof));
var tokensMof = TokenMofGenerator.ConvertToMof(tokens);
Assert.AreEqual(sourceMof, tokensMof);
// check the parser ast roundtrips ok
Expand Down
47 changes: 0 additions & 47 deletions src/Kingsland.MofParser.UnitTests/Helpers/ModelAssert.cs

This file was deleted.

Loading

0 comments on commit 937ecd1

Please sign in to comment.