Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix destructive tests #7

Merged
merged 1 commit into from

2 participants

@adzeitor

Replace FLUSHALL with DEL. Cleaning DB after each test.

@adzeitor adzeitor Fix destructive tests
Replace FLUSHALL with DEL. Cleaning DB after each test.
89c98a8
@knutin knutin merged commit 0ff8af2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2011
  1. @adzeitor

    Fix destructive tests

    adzeitor authored
    Replace FLUSHALL with DEL. Cleaning DB after each test.
This page is out of date. Refresh to see the latest.
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,7 +15,7 @@ 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])),
@@ -23,13 +23,16 @@ delete_test() ->
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(),
Something went wrong with that request. Please try again.