1- using System . ComponentModel . DataAnnotations ;
21using System . Text . RegularExpressions ;
32using AutoFixture . Xunit2 ;
43using HydraScript . Domain . FrontEnd . Lexer ;
54using HydraScript . Domain . FrontEnd . Lexer . Impl ;
65using HydraScript . Domain . FrontEnd . Lexer . TokenTypes ;
76using HydraScript . Infrastructure ;
7+ using Xunit . Abstractions ;
88
99namespace HydraScript . UnitTests . Domain . FrontEnd ;
1010
11- public class RegexLexerTests
11+ public class RegexLexerTests ( ITestOutputHelper output )
1212{
1313 private readonly RegexLexer _regexLexer = new (
1414 new Structure < GeneratedRegexContainer > ( new TokenTypesProvider ( ) ) ,
@@ -55,10 +55,11 @@ public void GetTokens_KeywordInsideIdent_Ident(string input)
5555
5656 [ Theory , AutoHydraScriptData ]
5757 public void GetTokens_MockedRegex_ValidOutput (
58- [ MinLength ( 10 ) , MaxLength ( 25 ) ] TokenInput [ ] tokenInputs ,
58+ LexerInput input ,
5959 [ Frozen ] IStructure structure ,
6060 RegexLexer lexer )
6161 {
62+ output . WriteLine ( input . ToString ( ) ) ;
6263 var patterns = TokenInput . Pattern . Split ( '|' ) ;
6364
6465 structure . Regex . ReturnsForAnyArgs (
@@ -71,13 +72,11 @@ public void GetTokens_MockedRegex_ValidOutput(
7172 structure . GetEnumerator ( )
7273 . ReturnsForAnyArgs ( _ => tokenTypes . GetEnumerator ( ) ) ;
7374
74- var tokens = lexer . GetTokens (
75- tokenInputs . Aggregate (
76- TokenInput . AdditiveIdentity ,
77- ( x , y ) => x + y ) . Value ) ;
78- for ( var i = 0 ; i < tokenInputs . Length ; i ++ )
75+ var tokens = lexer . GetTokens ( input . ToString ( ) ) ;
76+ for ( var i = 0 ; i < input . Count ; i ++ )
7977 {
80- tokens [ i ] . Value . Should ( ) . BeEquivalentTo ( tokenInputs [ i ] . Value ) ;
78+ output . WriteLine ( tokens [ i ] . ToString ( ) ) ;
79+ tokens [ i ] . Value . Should ( ) . BeEquivalentTo ( input [ i ] ) ;
8180 tokens [ i ] . Type . Should ( ) . BeOneOf ( tokenTypes ) ;
8281 }
8382 }
0 commit comments