Skip to content
Browse files

Fix destructive tests

Replace FLUSHALL with DEL. Cleaning DB after each test.
  • Loading branch information...
1 parent 7bc3cd1 commit 89c98a8add305d6c5e2496b3746785f822b5df19 @adzeitor adzeitor committed Sep 26, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 test/eredis_tests.erl
View
11 test/eredis_tests.erl
@@ -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 89c98a8

Please sign in to comment.
Something went wrong with that request. Please try again.