Skip to content

Commit

Permalink
chore: add some testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
NegatioN committed Oct 3, 2024
1 parent 4b4e51d commit b2b99c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/server/hset_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,17 @@ TEST_F(HSetFamilyTest, HExpireNoExpireEarly) {
EXPECT_THAT(Run({"HGETALL", "key"}), RespArray(UnorderedElementsAre("k0", "v0", "k1", "v1")));
}

TEST_F(HSetFamilyTest, HExpireNoSuchKey) {
EXPECT_EQ(CheckedInt({"HSET", "key", "k0", "v0"}), 1);
EXPECT_THAT(Run({"HEXPIRE", "key", "10", "FIELDS", "2", "k0", "k1"}),
RespArray(ElementsAre(IntArg(1), IntArg(-2))));
}

TEST_F(HSetFamilyTest, HExpireNoSuchField) {
EXPECT_THAT(Run({"HEXPIRE", "key", "10", "FIELDS", "2", "k0", "k1"}),
RespArray(ElementsAre(IntArg(-2), IntArg(-2))));
}

TEST_F(HSetFamilyTest, HExpireNoAddNew) {
Run({"HEXPIRE", "key", "10", "FIELDS", "1", "k0"});
EXPECT_THAT(Run({"HGETALL", "key"}), RespArray(ElementsAre()));
Expand Down

0 comments on commit b2b99c4

Please sign in to comment.