@@ -14,9 +14,10 @@ public Task SimpleWithinChunkMatch()
1414 if ( content . Length >= context . Length &&
1515 content [ ..context . Length ] . SequenceEqual ( context ) )
1616 {
17- return MatchResult . Match ( context . Length , "Universe" ) ;
17+ return new ( context . Length , "Universe" ) ;
1818 }
19- return MatchResult . NoMatch ( ) ;
19+
20+ return null ;
2021 } ) ;
2122
2223 return Verify ( builder . ToString ( ) ) ;
@@ -36,9 +37,10 @@ public Task MultipleWithinChunkMatches()
3637 if ( content . Length >= context . Length &&
3738 content [ ..context . Length ] . SequenceEqual ( context ) )
3839 {
39- return MatchResult . Match ( context . Length , "bar" ) ;
40+ return new ( context . Length , "bar" ) ;
4041 }
41- return MatchResult . NoMatch ( ) ;
42+
43+ return null ;
4244 } ) ;
4345
4446 return Verify ( builder . ToString ( ) ) ;
@@ -62,9 +64,10 @@ public Task CrossChunkMatch()
6264 if ( content . Length >= context . Length &&
6365 content [ ..context . Length ] . SequenceEqual ( context ) )
6466 {
65- return MatchResult . Match ( context . Length , "FOUND" ) ;
67+ return new ( context . Length , "FOUND" ) ;
6668 }
67- return MatchResult . NoMatch ( ) ;
69+
70+ return null ;
6871 } ) ;
6972
7073 var result = builder . ToString ( ) ;
@@ -95,9 +98,10 @@ public Task NoMatches()
9598 if ( content . Length >= context . Length &&
9699 content [ ..context . Length ] . SequenceEqual ( context ) )
97100 {
98- return MatchResult . Match ( context . Length , "Replaced" ) ;
101+ return new ( context . Length , "Replaced" ) ;
99102 }
100- return MatchResult . NoMatch ( ) ;
103+
104+ return null ;
101105 } ) ;
102106
103107 return Verify ( builder . ToString ( ) ) ;
@@ -117,9 +121,10 @@ public Task EmptyStringBuilder()
117121 if ( content . Length >= context . Length &&
118122 content [ ..context . Length ] . SequenceEqual ( context ) )
119123 {
120- return MatchResult . Match ( context . Length , "replaced" ) ;
124+ return new ( context . Length , "replaced" ) ;
121125 }
122- return MatchResult . NoMatch ( ) ;
126+
127+ return null ;
123128 } ) ;
124129
125130 return Verify ( builder . ToString ( ) ) ;
@@ -139,9 +144,10 @@ public Task MatchAtStart()
139144 if ( content . Length >= context . Length &&
140145 content [ ..context . Length ] . SequenceEqual ( context ) )
141146 {
142- return MatchResult . Match ( context . Length , "Result" ) ;
147+ return new ( context . Length , "Result" ) ;
143148 }
144- return MatchResult . NoMatch ( ) ;
149+
150+ return null ;
145151 } ) ;
146152
147153 return Verify ( builder . ToString ( ) ) ;
@@ -161,9 +167,10 @@ public Task MatchAtEnd()
161167 if ( content . Length >= context . Length &&
162168 content [ ..context . Length ] . SequenceEqual ( context ) )
163169 {
164- return MatchResult . Match ( context . Length , "Result" ) ;
170+ return new ( context . Length , "Result" ) ;
165171 }
166- return MatchResult . NoMatch ( ) ;
172+
173+ return null ;
167174 } ) ;
168175
169176 return Verify ( builder . ToString ( ) ) ;
@@ -183,9 +190,10 @@ public Task OverlappingMatches()
183190 if ( content . Length >= context . Length &&
184191 content [ ..context . Length ] . SequenceEqual ( context ) )
185192 {
186- return MatchResult . Match ( context . Length , "bb" ) ;
193+ return new ( context . Length , "bb" ) ;
187194 }
188- return MatchResult . NoMatch ( ) ;
195+
196+ return null ;
189197 } ) ;
190198
191199 return Verify ( builder . ToString ( ) ) ;
@@ -205,14 +213,16 @@ public Task DifferentReplacementLengths()
205213 if ( content . Length >= context . Short . Length &&
206214 content [ ..context . Short . Length ] . SequenceEqual ( context . Short ) )
207215 {
208- return MatchResult . Match ( context . Short . Length , "replaced" ) ;
216+ return new ( context . Short . Length , "replaced" ) ;
209217 }
218+
210219 if ( content . Length >= context . Long . Length &&
211220 content [ ..context . Long . Length ] . SequenceEqual ( context . Long ) )
212221 {
213- return MatchResult . Match ( context . Long . Length , "r" ) ;
222+ return new ( context . Long . Length , "r" ) ;
214223 }
215- return MatchResult . NoMatch ( ) ;
224+
225+ return null ;
216226 } ) ;
217227
218228 return Verify ( builder . ToString ( ) ) ;
@@ -231,9 +241,10 @@ public Task SingleCharacterMatch()
231241 {
232242 if ( content . Length >= 1 && content [ 0 ] == context )
233243 {
234- return MatchResult . Match ( 1 , "x" ) ;
244+ return new ( 1 , "x" ) ;
235245 }
236- return MatchResult . NoMatch ( ) ;
246+
247+ return null ;
237248 } ) ;
238249
239250 return Verify ( builder . ToString ( ) ) ;
@@ -259,9 +270,10 @@ public Task LargeStringBuilderWithMultipleChunks()
259270 if ( content . Length >= context . Length &&
260271 content [ ..context . Length ] . SequenceEqual ( context ) )
261272 {
262- return MatchResult . Match ( context . Length , "MATCH" ) ;
273+ return new ( context . Length , "MATCH" ) ;
263274 }
264- return MatchResult . NoMatch ( ) ;
275+
276+ return null ;
265277 } ) ;
266278
267279 var result = builder . ToString ( ) ;
@@ -273,7 +285,7 @@ public Task LargeStringBuilderWithMultipleChunks()
273285 index += "MATCH" . Length ;
274286 }
275287
276- return Verify ( new { MatchCount = matchCount } ) ;
288+ return Verify ( new { MatchCount = matchCount } ) ;
277289 }
278290
279291 [ Fact ]
@@ -297,9 +309,10 @@ public Task PatternSplitAcrossChunkBoundary()
297309 if ( content . Length >= context . Length &&
298310 content [ ..context . Length ] . SequenceEqual ( context ) )
299311 {
300- return MatchResult . Match ( context . Length , "SUCCESS" ) ;
312+ return new ( context . Length , "SUCCESS" ) ;
301313 }
302- return MatchResult . NoMatch ( ) ;
314+
315+ return null ;
303316 } ) ;
304317
305318 var result = builder . ToString ( ) ;
@@ -327,9 +340,10 @@ public Task ConsecutiveMatches()
327340 if ( content . Length >= context . Length &&
328341 content [ ..context . Length ] . SequenceEqual ( context ) )
329342 {
330- return MatchResult . Match ( context . Length , "XY" ) ;
343+ return new ( context . Length , "XY" ) ;
331344 }
332- return MatchResult . NoMatch ( ) ;
345+
346+ return null ;
333347 } ) ;
334348
335349 return Verify ( builder . ToString ( ) ) ;
@@ -357,9 +371,10 @@ public Task PatternSpanningThreeChunks()
357371 if ( content . Length >= context . Length &&
358372 content [ ..context . Length ] . SequenceEqual ( context ) )
359373 {
360- return MatchResult . Match ( context . Length , "FOUND!!!" ) ;
374+ return new ( context . Length , "FOUND!!!" ) ;
361375 }
362- return MatchResult . NoMatch ( ) ;
376+
377+ return null ;
363378 } ) ;
364379
365380 var result = builder . ToString ( ) ;
@@ -393,9 +408,10 @@ public Task PatternSpanningThreeChunks_AlternativeLayout()
393408 if ( content . Length >= context . Length &&
394409 content [ ..context . Length ] . SequenceEqual ( context ) )
395410 {
396- return MatchResult . Match ( context . Length , "FOUND!!!" ) ;
411+ return new ( context . Length , "FOUND!!!" ) ;
397412 }
398- return MatchResult . NoMatch ( ) ;
413+
414+ return null ;
399415 } ) ;
400416
401417 var result = builder . ToString ( ) ;
@@ -428,9 +444,10 @@ public Task PatternSpanningFourChunks()
428444 if ( content . Length >= context . Length &&
429445 content [ ..context . Length ] . SequenceEqual ( context ) )
430446 {
431- return MatchResult . Match ( context . Length , "SUCCESS!" ) ;
447+ return new ( context . Length , "SUCCESS!" ) ;
432448 }
433- return MatchResult . NoMatch ( ) ;
449+
450+ return null ;
434451 } ) ;
435452
436453 var result = builder . ToString ( ) ;
@@ -462,9 +479,10 @@ public Task MultipleMatchesAcrossChunks()
462479 if ( content . Length >= context . Length &&
463480 content [ ..context . Length ] . SequenceEqual ( context ) )
464481 {
465- return MatchResult . Match ( context . Length , "MATCH" ) ;
482+ return new ( context . Length , "MATCH" ) ;
466483 }
467- return MatchResult . NoMatch ( ) ;
484+
485+ return null ;
468486 } ) ;
469487
470488 var result = builder . ToString ( ) ;
@@ -476,7 +494,7 @@ public Task MultipleMatchesAcrossChunks()
476494 index += "MATCH" . Length ;
477495 }
478496
479- return Verify ( new { MatchCount = matchCount } ) ;
497+ return Verify ( new { MatchCount = matchCount } ) ;
480498 }
481499
482500 [ Fact ]
@@ -487,18 +505,19 @@ public Task VariableLengthMatches()
487505 CrossChunkMatcher . ReplaceAll (
488506 builder ,
489507 maxLength : 8 ,
490- context : new [ ] { "cat" , "dog" , "bird" , "elephant" } ,
508+ context : new [ ] { "cat" , "dog" , "bird" , "elephant" } ,
491509 matcher : static ( content , _ , context ) =>
492510 {
493511 foreach ( var word in context )
494512 {
495513 if ( content . Length >= word . Length &&
496514 content [ ..word . Length ] . SequenceEqual ( word ) )
497515 {
498- return MatchResult . Match ( word . Length , "animal" ) ;
516+ return new ( word . Length , "animal" ) ;
499517 }
500518 }
501- return MatchResult . NoMatch ( ) ;
519+
520+ return null ;
502521 } ) ;
503522
504523 return Verify ( builder . ToString ( ) ) ;
0 commit comments