@@ -36,8 +36,8 @@ private static void Test(ReadOnlySpan<char> haystack, ReadOnlySpan<char> haystac
36
36
SearchValues < string > searchValues = SearchValues . Create ( needles , comparisonType ) ;
37
37
38
38
int index = haystack . IndexOfAny ( searchValues ) ;
39
- Assert . Equal ( index , haystackCopy . IndexOfAny ( searchValues ) ) ;
40
- Assert . Equal ( index , IndexOfAnyReferenceImpl ( haystack , needles , comparisonType ) ) ;
39
+ AssertEqual ( index , haystackCopy . IndexOfAny ( searchValues ) , searchValues ) ;
40
+ AssertEqual ( index , IndexOfAnyReferenceImpl ( haystack , needles , comparisonType ) , searchValues ) ;
41
41
}
42
42
43
43
private static int IndexOfAnyReferenceImpl ( ReadOnlySpan < char > haystack , string [ ] needles , StringComparison comparisonType )
@@ -55,4 +55,15 @@ private static int IndexOfAnyReferenceImpl(ReadOnlySpan<char> haystack, string[]
55
55
56
56
return minIndex == int . MaxValue ? - 1 : minIndex ;
57
57
}
58
+
59
+ private static void AssertEqual ( int expected , int actual , SearchValues < string > searchValues )
60
+ {
61
+ if ( expected != actual )
62
+ {
63
+ Type implType = searchValues . GetType ( ) ;
64
+ string impl = $ "{ implType . Name } [{ string . Join ( ", " , implType . GenericTypeArguments . Select ( t => t . Name ) ) } ]";
65
+
66
+ throw new Exception ( $ "Expected { expected } , got { actual } for impl='{ impl } '") ;
67
+ }
68
+ }
58
69
}
0 commit comments