mirror of https://github.com/djcb/mu.git
tests: update for move_message API update
This commit is contained in:
parent
0b516c18c2
commit
da7c3b0c9a
|
@ -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"));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue