From da7c3b0c9a1079d4654e1cc866e2edcdd8c243ee Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 3 Dec 2022 16:45:10 +0200 Subject: [PATCH] tests: update for move_message API update --- lib/tests/test-mu-store-query.cc | 11 +++++++---- lib/tests/test-mu-store.cc | 14 ++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/tests/test-mu-store-query.cc b/lib/tests/test-mu-store-query.cc index cd44bfed..051a81c8 100644 --- a/lib/tests/test-mu-store-query.cc +++ b/lib/tests/test-mu-store-query.cc @@ -565,9 +565,12 @@ Boo! /* * mark as read, i.e. move to cur/; ensure it really moved. */ - auto moved_msg = store.move_message(old_docid, Nothing, Flags::Seen, rename); - assert_valid_result(moved_msg); - const auto new_path = moved_msg->path(); + auto move_opts{rename ? Store::MoveOptions::ChangeName : Store::MoveOptions::None}; + auto moved_msgs = store.move_message(old_docid, Nothing, Flags::Seen, move_opts); + assert_valid_result(moved_msgs); + g_assert_true(moved_msgs->size() == 1); + const auto& moved_msg{moved_msgs->at(0).second}; + const auto new_path = moved_msg.path(); if (!rename) assert_equal(new_path, store.properties().root_maildir + "/inbox/cur/msg:2,S"); g_assert_cmpuint(store.size(), ==, 1); @@ -576,7 +579,7 @@ Boo! /* also ensure that the cached sexp for the message has been updated; * that's what mu4e uses */ - const auto moved_sexp{moved_msg->sexp()}; + const auto moved_sexp{moved_msg.sexp()}; //std::cerr << "@@ " << *moved_msg << '\n'; g_assert_true(moved_sexp.plistp()); g_assert_true(moved_sexp.has_prop(":path")); diff --git a/lib/tests/test-mu-store.cc b/lib/tests/test-mu-store.cc index 4f4f577d..7801ad06 100644 --- a/lib/tests/test-mu-store.cc +++ b/lib/tests/test-mu-store.cc @@ -373,14 +373,16 @@ Yes, that would be excellent. // Move the message from new->cur std::this_thread::sleep_for(1s); /* ctime should change */ - const auto msg3 = store->move_message(msg->docid(), {}, Flags::Seen); - assert_valid_result(msg3); - assert_equal(msg3->maildir(), "/a"); - assert_equal(msg3->path(), tempdir2.path() + "/Maildir/a/cur/msg:2,S"); - g_assert_true(::access(msg3->path().c_str(), R_OK)==0); + const auto msgs3 = store->move_message(msg->docid(), {}, Flags::Seen); + assert_valid_result(msgs3); + g_assert_true(msgs3->size() == 1); + const auto& msg3{msgs3->at(0).second}; + assert_equal(msg3.maildir(), "/a"); + assert_equal(msg3.path(), tempdir2.path() + "/Maildir/a/cur/msg:2,S"); + g_assert_true(::access(msg3.path().c_str(), R_OK)==0); g_assert_false(::access(oldpath.c_str(), R_OK)==0); - g_debug("%s", msg3->sexp().to_string().c_str()); + g_debug("%s", msg3.sexp().to_string().c_str()); g_assert_cmpuint(store->size(), ==, 1); }