@@ -554,7 +554,7 @@ public void Should_translate_hour()
554
554
}
555
555
556
556
[ SkippableFact ]
557
- public void Should_translate_indexOf ( )
557
+ public void Should_translate_indexOfBytes ( )
558
558
{
559
559
RequireServer . Where ( minimumVersion : "3.3.6" ) ;
560
560
@@ -583,6 +583,36 @@ public void Should_translate_indexOf()
583
583
result . Value . Result . Should ( ) . Be ( - 1 ) ;
584
584
}
585
585
586
+ [ SkippableFact ]
587
+ public void Should_translate_indexOfCP ( )
588
+ {
589
+ RequireServer . Where ( minimumVersion : "3.3.6" ) ;
590
+
591
+ var result = Project ( x => new { Result = x . A . IndexOf ( 'e' ) } , __codePointTranslationOptions ) ;
592
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" ] }, _id: 0 }" ) ;
593
+ result . Value . Result . Should ( ) . Be ( 2 ) ;
594
+
595
+ result = Project ( x => new { Result = x . A . IndexOf ( "e" ) } , __codePointTranslationOptions ) ;
596
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" ] }, _id: 0 }" ) ;
597
+ result . Value . Result . Should ( ) . Be ( 2 ) ;
598
+
599
+ result = Project ( x => new { Result = x . A . IndexOf ( 'e' , 4 ) } , __codePointTranslationOptions ) ;
600
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" , 4] }, _id: 0 }" ) ;
601
+ result . Value . Result . Should ( ) . Be ( 6 ) ;
602
+
603
+ result = Project ( x => new { Result = x . A . IndexOf ( "e" , 4 ) } , __codePointTranslationOptions ) ;
604
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" , 4] }, _id: 0 }" ) ;
605
+ result . Value . Result . Should ( ) . Be ( 6 ) ;
606
+
607
+ result = Project ( x => new { Result = x . A . IndexOf ( 'e' , 4 , 2 ) } , __codePointTranslationOptions ) ;
608
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" , 4, { $add: [4, 2] }] }, _id: 0 }" ) ;
609
+ result . Value . Result . Should ( ) . Be ( - 1 ) ;
610
+
611
+ result = Project ( x => new { Result = x . A . IndexOf ( "e" , 4 , 2 ) } , __codePointTranslationOptions ) ;
612
+ result . Projection . Should ( ) . Be ( "{ Result: { \" $indexOfCP\" : [\" $A\" , \" e\" , 4, { $add: [4, 2] }] }, _id: 0 }" ) ;
613
+ result . Value . Result . Should ( ) . Be ( - 1 ) ;
614
+ }
615
+
586
616
[ Fact ]
587
617
public void Should_translate_less_than ( )
588
618
{
0 commit comments