@@ -303,20 +303,43 @@ void main() {
303
303
qp.close ();
304
304
});
305
305
306
- final qp = queryStrings.property (tString) as StringPropertyQuery ;
307
-
308
- List <String > addSuffix (List <int > s) {
309
- return s.map ((t) => '${t }withSuffix' ).toList ();
310
- }
311
-
312
- final caps = ['2WITHSUFFIX' ];
313
- final defaultResult = addSuffix ([1 , 2 , 1 , 2 ]) + caps;
314
- expect (qp.find (), defaultResult);
315
- expect ((qp..distinct = true ..caseSensitive = true ) .find (), caps + addSuffix ([2 ,1 ]) );
316
- expect ((qp..distinct = false ..caseSensitive = true ) .find (replaceNullWith: 'meh' ), addSuffix ([1 ,2 ,1 ,2 ]) + caps);
317
- expect ((qp..distinct = true ..caseSensitive = false ).find (), addSuffix ([2 ,1 ]));
318
- expect ((qp..distinct = false ..caseSensitive = false ).find (replaceNullWith: 'meh' ), defaultResult);
319
- qp.close ();
306
+ final stringQuery = queryStrings.property (tString) as StringPropertyQuery ;
307
+
308
+ // Note: results are in no particular order, so sort them before comparing.
309
+ final defaultResults = ['1withSuffix' , '1withSuffix' , '2WITHSUFFIX' , '2withSuffix' , '2withSuffix' ];
310
+ var results = stringQuery.find ()
311
+ ..sort ();
312
+ expect (results, defaultResults);
313
+
314
+ var resultsNone = (stringQuery
315
+ ..distinct = false
316
+ ..caseSensitive = false )
317
+ .find (replaceNullWith: 'meh' )
318
+ ..sort ();
319
+ expect (resultsNone, defaultResults);
320
+
321
+ var resultsDC = (stringQuery
322
+ ..distinct = true
323
+ ..caseSensitive = true )
324
+ .find ()
325
+ ..sort ();
326
+ expect (resultsDC, ['1withSuffix' , '2WITHSUFFIX' , '2withSuffix' ]);
327
+
328
+ var resultsC = (stringQuery
329
+ ..distinct = false
330
+ ..caseSensitive = true )
331
+ .find (replaceNullWith: 'meh' )
332
+ ..sort ();
333
+ expect (resultsC, defaultResults);
334
+
335
+ var resultsD = (stringQuery
336
+ ..distinct = true
337
+ ..caseSensitive = false )
338
+ .find ()
339
+ ..sort ();
340
+ expect (resultsD, ['1withSuffix' , '2withSuffix' ]);
341
+
342
+ stringQuery.close ();
320
343
321
344
queryIntegers.close ();
322
345
queryFloats.close ();
0 commit comments