@@ -1097,6 +1097,42 @@ - (void)testQueryAll {
10971097 [task waitUntilFinished ];
10981098}
10991099
1100+ - (void )testQueryContainedBy {
1101+ PFOfflineQueryLogic *logic = [[PFOfflineQueryLogic alloc ] init ];
1102+ PFSQLiteDatabase *database = [[PFSQLiteDatabase alloc ] init ];
1103+
1104+ PFObject *object = [PFObject objectWithClassName: @" Object" ];
1105+ object[@" numbers" ] = @[@0 , @2 ];
1106+ object[@" letters" ] = @[@" b" , @" c" , @" d" ];
1107+ PFQuery *query = [PFQuery queryWithClassName: @" Object" ];
1108+ BFTask *task = [BFTask taskWithResult: nil ];
1109+
1110+ [query whereKey: @" numbers" containedBy: @[@1 , @2 , @3 , @4 ]];
1111+ PFConstraintMatcherBlock matcherBlock = [logic createMatcherForQueryState: query.state user: _user];
1112+
1113+ // Check matcher
1114+ task = [[task continueWithBlock: ^id (BFTask *task) {
1115+ return matcherBlock (object, database);
1116+ }] continueWithBlock: ^id (BFTask *task) {
1117+ XCTAssertFalse ([task.result boolValue ]);
1118+ return nil ;
1119+ }];
1120+
1121+ query = [PFQuery queryWithClassName: @" Object" ];
1122+ [query whereKey: @" letters" containedBy: @[@" a" , @" b" , @" c" , @" d" , @" e" ]];
1123+ matcherBlock = [logic createMatcherForQueryState: query.state user: _user];
1124+
1125+ // Check matcher
1126+ task = [[task continueWithBlock: ^id (BFTask *task) {
1127+ return matcherBlock (object, database);
1128+ }] continueWithBlock: ^id (BFTask *task) {
1129+ XCTAssertTrue ([task.result boolValue ]);
1130+ return nil ;
1131+ }];
1132+
1133+ [task waitUntilFinished ];
1134+ }
1135+
11001136- (void )testQueryRegex {
11011137 PFOfflineQueryLogic *logic = [[PFOfflineQueryLogic alloc ] init ];
11021138 PFSQLiteDatabase *database = [[PFSQLiteDatabase alloc ] init ];
0 commit comments