Permalink
Browse files

Merge pull request #7 from adzeitor/master

Fix destructive tests
  • Loading branch information...
2 parents 7bc3cd1 + 89c98a8 commit 0ff8af2c01fb33b767554cb6c82f5de10a7688fe @knutin knutin committed Sep 26, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 test/eredis_tests.erl
View
@@ -6,7 +6,7 @@
get_set_test() ->
C = c(),
- ?assertEqual({ok, <<"OK">>}, eredis:q(C, ["FLUSHALL"])),
+ ?assertMatch({ok, _}, eredis:q(C, ["DEL", foo])),
?assertEqual({ok, undefined}, eredis:q(C, ["GET", foo])),
?assertEqual({ok, <<"OK">>}, eredis:q(C, ["SET", foo, bar])),
@@ -15,21 +15,24 @@ get_set_test() ->
delete_test() ->
C = c(),
- ?assertEqual({ok, <<"OK">>}, eredis:q(C, ["FLUSHALL"])),
+ ?assertMatch({ok, _}, eredis:q(C, ["DEL", foo])),
?assertEqual({ok, <<"OK">>}, eredis:q(C, ["SET", foo, bar])),
?assertEqual({ok, <<"1">>}, eredis:q(C, ["DEL", foo])),
?assertEqual({ok, undefined}, eredis:q(C, ["GET", foo])).
mset_mget_test() ->
C = c(),
- ?assertEqual({ok, <<"OK">>}, eredis:q(C, ["FLUSHALL"])),
Keys = lists:seq(1, 1000),
+
+ ?assertMatch({ok, _}, eredis:q(C, ["DEL" | Keys])),
+
KeyValuePairs = [[K, K*2] || K <- Keys],
ExpectedResult = [list_to_binary(integer_to_list(K * 2)) || K <- Keys],
?assertEqual({ok, <<"OK">>}, eredis:q(C, ["MSET" | lists:flatten(KeyValuePairs)])),
- ?assertEqual({ok, ExpectedResult}, eredis:q(C, ["MGET" | Keys])).
+ ?assertEqual({ok, ExpectedResult}, eredis:q(C, ["MGET" | Keys])),
+ ?assertMatch({ok, _}, eredis:q(C, ["DEL" | Keys])).
c() ->
Res = eredis:start_link(),

0 comments on commit 0ff8af2

Please sign in to comment.