@@ -554,7 +554,7 @@ public void Should_translate_hour()
554554 }
555555
556556 [ SkippableFact ]
557- public void Should_translate_indexOf ( )
557+ public void Should_translate_indexOfBytes ( )
558558 {
559559 RequireServer . Where ( minimumVersion : "3.3.6" ) ;
560560
@@ -583,6 +583,36 @@ public void Should_translate_indexOf()
583583 result . Value . Result . Should ( ) . Be ( - 1 ) ;
584584 }
585585
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+
586616 [ Fact ]
587617 public void Should_translate_less_than ( )
588618 {
0 commit comments