@@ -898,14 +898,17 @@ static void TestCore(CompareInfo compareInfo, string source, string value, int s
898898
899899 Assert . Equal ( offsetResult , sourceBoundedSpan . IndexOf ( valueBoundedSpan , GetStringComparison ( options ) ) ) ;
900900 Assert . Equal ( offsetResult , compareInfo . IndexOf ( sourceBoundedSpan , valueBoundedSpan , options ) ) ;
901- Assert . Equal ( offsetResult , compareInfo . IndexOf ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
902- if ( offsetResult >= 0 )
903- {
904- Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
905- }
906- else
901+ if ( PlatformDetection . IsNotHybridGlobalizationOnApplePlatform )
907902 {
908- Assert . Equal ( 0 , matchLength ) ; // not found
903+ Assert . Equal ( offsetResult , compareInfo . IndexOf ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
904+ if ( offsetResult >= 0 )
905+ {
906+ Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
907+ }
908+ else
909+ {
910+ Assert . Equal ( 0 , matchLength ) ; // not found
911+ }
909912 }
910913 }
911914 }
@@ -958,14 +961,17 @@ static void TestCore(CompareInfo compareInfo, string source, string value, int s
958961
959962 Assert . Equal ( result , sourceBoundedSpan . LastIndexOf ( valueBoundedSpan , GetStringComparison ( options ) ) ) ;
960963 Assert . Equal ( result , compareInfo . LastIndexOf ( sourceBoundedSpan , valueBoundedSpan , options ) ) ;
961- Assert . Equal ( result , compareInfo . LastIndexOf ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
962- if ( result >= 0 )
963- {
964- Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
965- }
966- else
964+ if ( PlatformDetection . IsNotHybridGlobalizationOnApplePlatform )
967965 {
968- Assert . Equal ( 0 , matchLength ) ; // not found
966+ Assert . Equal ( result , compareInfo . LastIndexOf ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
967+ if ( result >= 0 )
968+ {
969+ Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
970+ }
971+ else
972+ {
973+ Assert . Equal ( 0 , matchLength ) ; // not found
974+ }
969975 }
970976 }
971977 }
@@ -993,14 +999,17 @@ public void TestIsPrefix(string source, string value, CompareOptions options, bo
993999
9941000 Assert . Equal ( result , sourceBoundedSpan . StartsWith ( valueBoundedSpan , GetStringComparison ( options ) ) ) ;
9951001 Assert . Equal ( result , compareInfo . IsPrefix ( sourceBoundedSpan , valueBoundedSpan , options ) ) ;
996- Assert . Equal ( result , compareInfo . IsPrefix ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
997- if ( result )
998- {
999- Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
1000- }
1001- else
1002+ if ( PlatformDetection . IsNotHybridGlobalizationOnApplePlatform )
10021003 {
1003- Assert . Equal ( 0 , matchLength ) ; // not found
1004+ Assert . Equal ( result , compareInfo . IsPrefix ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
1005+ if ( result )
1006+ {
1007+ Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
1008+ }
1009+ else
1010+ {
1011+ Assert . Equal ( 0 , matchLength ) ; // not found
1012+ }
10041013 }
10051014 }
10061015 }
@@ -1028,14 +1037,17 @@ public void TestIsSuffix(string source, string value, CompareOptions options, bo
10281037
10291038 Assert . Equal ( result , sourceBoundedSpan . EndsWith ( valueBoundedSpan , GetStringComparison ( options ) ) ) ;
10301039 Assert . Equal ( result , compareInfo . IsSuffix ( sourceBoundedSpan , valueBoundedSpan , options ) ) ;
1031- Assert . Equal ( result , compareInfo . IsSuffix ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
1032- if ( result )
1033- {
1034- Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
1035- }
1036- else
1040+ if ( PlatformDetection . IsNotHybridGlobalizationOnApplePlatform )
10371041 {
1038- Assert . Equal ( 0 , matchLength ) ; // not found
1042+ Assert . Equal ( result , compareInfo . IsSuffix ( sourceBoundedSpan , valueBoundedSpan , options , out int matchLength ) ) ;
1043+ if ( result )
1044+ {
1045+ Assert . Equal ( valueBoundedSpan . Length , matchLength ) ; // Invariant mode should perform non-linguistic comparisons
1046+ }
1047+ else
1048+ {
1049+ Assert . Equal ( 0 , matchLength ) ; // not found
1050+ }
10391051 }
10401052 }
10411053 }
0 commit comments