Skip to content

Commit 1a92b1d

Browse files
committed
test: add assert for exception message
1 parent 62ecd85 commit 1a92b1d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

others/lru_cache2.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,8 @@ static void test() {
252252
// when 6 was added
253253
try {
254254
cache.get(1);
255-
assert(false);
256255
} catch (const std::runtime_error &e) {
257-
std::cout << "Expected - std::runtime_error\n";
256+
assert(std::string(e.what()) == "key is not present in the cache");
258257
}
259258

260259
// test retrieval of all items in the cache

0 commit comments

Comments
 (0)