@@ -280,11 +280,11 @@ mget(Cluster, ClusterAlt, Keys) ->
280280 Results = mero :mget (Cluster , Keys , 10000 ),
281281 ResultsAlt = mero :mget (ClusterAlt , Keys , 10000 ),
282282 io :format (" Checking mget ~p ~n " , [Results ]),
283- [ begin
284- ? assertEqual ({value , {Key , Key }}, lists :keysearch (Key , 1 , Results )),
285- ? assertEqual ({value , {Key , Key }}, lists :keysearch (Key , 1 , ResultsAlt ))
286- end
287- || Key <- Keys ] .
283+ lists : foreach ( fun ( Key ) ->
284+ ? assertEqual ({value , {Key , Key }}, lists :keysearch (Key , 1 , Results )),
285+ ? assertEqual ({value , {Key , Key }}, lists :keysearch (Key , 1 , ResultsAlt ))
286+ end ,
287+ Keys ) .
288288
289289mincrement (Cluster = cluster_txt , Keys ) ->
290290 {error , not_supportable } = mero :mincrement_counter (Cluster , Keys );
@@ -337,43 +337,45 @@ add(Cluster, ClusterAlt, Keys) ->
337337 io :format (" Attempt to add success to 5000 ~n " ),
338338 Expected = <<" 5000" >>,
339339 Expected2 = <<" asdf" >>,
340- [begin
341- ? assertEqual (ok , mero :add (Cluster , Key , Expected , 10000 , 10000 )),
342- ? assertEqual ({error , not_stored }, mero :add (cluster_txt , Key , Expected2 , 10000 , 10000 )),
343- ? assertEqual ({error , already_exists },
344- mero :add (cluster_binary , Key , Expected2 , 10000 , 10000 )),
345- {Key , Value } = mero :get (Cluster , Key ),
346- {Key , Value2 } = mero :get (ClusterAlt , Key ),
347- io :format (" Checking get ~p ~p ~n " , [Value , Value2 ]),
348- ? assertEqual (Expected , Value ),
349- ? assertEqual (Expected , Value2 )
350- end
351- || Key <- Keys ].
340+ lists :foreach (fun (Key ) ->
341+ ? assertEqual (ok , mero :add (Cluster , Key , Expected , 10000 , 10000 )),
342+ ? assertEqual ({error , not_stored },
343+ mero :add (cluster_txt , Key , Expected2 , 10000 , 10000 )),
344+ ? assertEqual ({error , already_exists },
345+ mero :add (cluster_binary , Key , Expected2 , 10000 , 10000 )),
346+ {Key , Value } = mero :get (Cluster , Key ),
347+ {Key , Value2 } = mero :get (ClusterAlt , Key ),
348+ io :format (" Checking get ~p ~p ~n " , [Value , Value2 ]),
349+ ? assertEqual (Expected , Value ),
350+ ? assertEqual (Expected , Value2 )
351+ end ,
352+ Keys ).
352353
353354cas (Cluster , ClusterAlt , Keys ) ->
354355 Value1 = <<" asdf" >>,
355356 Value2 = <<" foo" >>,
356357 Value3 = <<" bar" >>,
357- [begin
358- ? assertEqual ({error , not_found }, mero :cas (Cluster , Key , Value1 , 10000 , 10000 , 12345 )),
359- await_connected (Cluster ),
360- ? assertEqual (ok , mero :set (Cluster , Key , Value1 , 10000 , 10000 )),
361- ? assertEqual ({Key , Value1 }, mero :get (ClusterAlt , Key )),
362- {Key , Value1 , CAS } = mero :gets (Cluster , Key ),
363- {Key , Value1 , CAS } = mero :gets (ClusterAlt , Key ),
364- ? assertEqual ({error , already_exists },
365- mero :cas (Cluster , Key , Value2 , 10000 , 10000 , CAS + 1 )),
366- await_connected (Cluster ),
367- ? assertEqual (ok , mero :cas (Cluster , Key , Value2 , 10000 , 10000 , CAS )),
368- ? assertEqual ({error , already_exists },
369- mero :cas (ClusterAlt , Key , Value2 , 10000 , 10000 , CAS )),
370- await_connected (ClusterAlt ),
371- ? assertEqual ({Key , Value2 }, mero :get (ClusterAlt , Key )),
372- ? assertEqual (ok , mero :set (Cluster , Key , Value3 , 10000 , 10000 )),
373- {Key , Value3 , NCAS } = mero :gets (Cluster , Key ),
374- ? assertNotEqual (CAS , NCAS )
375- end
376- || Key <- Keys ].
358+ lists :foreach (fun (Key ) ->
359+ ? assertEqual ({error , not_found },
360+ mero :cas (Cluster , Key , Value1 , 10000 , 10000 , 12345 )),
361+ await_connected (Cluster ),
362+ ? assertEqual (ok , mero :set (Cluster , Key , Value1 , 10000 , 10000 )),
363+ ? assertEqual ({Key , Value1 }, mero :get (ClusterAlt , Key )),
364+ {Key , Value1 , CAS } = mero :gets (Cluster , Key ),
365+ {Key , Value1 , CAS } = mero :gets (ClusterAlt , Key ),
366+ ? assertEqual ({error , already_exists },
367+ mero :cas (Cluster , Key , Value2 , 10000 , 10000 , CAS + 1 )),
368+ await_connected (Cluster ),
369+ ? assertEqual (ok , mero :cas (Cluster , Key , Value2 , 10000 , 10000 , CAS )),
370+ ? assertEqual ({error , already_exists },
371+ mero :cas (ClusterAlt , Key , Value2 , 10000 , 10000 , CAS )),
372+ await_connected (ClusterAlt ),
373+ ? assertEqual ({Key , Value2 }, mero :get (ClusterAlt , Key )),
374+ ? assertEqual (ok , mero :set (Cluster , Key , Value3 , 10000 , 10000 )),
375+ {Key , Value3 , NCAS } = mero :gets (Cluster , Key ),
376+ ? assertNotEqual (CAS , NCAS )
377+ end ,
378+ Keys ).
377379
378380% % this is needed b/c our test server doesn't emulate a real memcached server with 100%
379381% % accuracy.
0 commit comments