many: update for lib/message updates
Adapt to the new names / directory. Big commit, but mostly just very boring renaming.
This commit is contained in:
@ -17,47 +17,6 @@
|
||||
#
|
||||
# tests
|
||||
#
|
||||
|
||||
test('test-message-contact',
|
||||
executable('test-message-contact',
|
||||
'../mu-message-contact.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
|
||||
test('test-message-document',
|
||||
executable('test-message-document',
|
||||
'../mu-message-document.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-message-fields',
|
||||
executable('test-message-fields',
|
||||
'../mu-message-fields.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-message-flags',
|
||||
executable('test-message-flags',
|
||||
'../mu-message-flags.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
test('test-message-priority',
|
||||
executable('test-message-priority',
|
||||
'../mu-message-priority.cc',
|
||||
install: false,
|
||||
cpp_args: ['-DBUILD_TESTS'],
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep,
|
||||
lib_test_mu_common_dep]))
|
||||
|
||||
test('test-maildir',
|
||||
executable('test-maildir',
|
||||
'test-mu-maildir.cc',
|
||||
@ -77,7 +36,7 @@ test('test-query',
|
||||
executable('test-query',
|
||||
'test-query.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
|
||||
test('test-tokenizer',
|
||||
executable('test-tokenizer',
|
||||
@ -101,4 +60,4 @@ test('test-parser',
|
||||
executable('test-parser',
|
||||
'test-parser.cc',
|
||||
install: false,
|
||||
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
dependencies: [glib_dep, gmime_dep, lib_mu_dep, lib_test_mu_common_dep]))
|
||||
|
||||
@ -174,24 +174,24 @@ test_mu_maildir_flags_from_path(void)
|
||||
int i;
|
||||
struct {
|
||||
const char* path;
|
||||
MessageFlags flags;
|
||||
Flags flags;
|
||||
} paths[] = {
|
||||
{"/home/foo/Maildir/test/cur/123456:2,FSR",
|
||||
(MessageFlags::Replied | MessageFlags::Seen | MessageFlags::Flagged)},
|
||||
{"/home/foo/Maildir/test/new/123456", MessageFlags::New},
|
||||
(Flags::Replied | Flags::Seen | Flags::Flagged)},
|
||||
{"/home/foo/Maildir/test/new/123456", Flags::New},
|
||||
{/* NOTE: when in new/, the :2,.. stuff is ignored */
|
||||
"/home/foo/Maildir/test/new/123456:2,FR",
|
||||
MessageFlags::New},
|
||||
Flags::New},
|
||||
{"/home/foo/Maildir/test/cur/123456:2,DTP",
|
||||
(MessageFlags::Draft | MessageFlags::Trashed | MessageFlags::Passed)},
|
||||
{"/home/foo/Maildir/test/cur/123456:2,S", MessageFlags::Seen}};
|
||||
(Flags::Draft | Flags::Trashed | Flags::Passed)},
|
||||
{"/home/foo/Maildir/test/cur/123456:2,S", Flags::Seen}};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
auto res{mu_maildir_flags_from_path(paths[i].path)};
|
||||
g_assert_true(!!res);
|
||||
if (g_test_verbose())
|
||||
g_print("%s -> <%s>\n", paths[i].path,
|
||||
message_flags_to_string(res.value()).c_str());
|
||||
flags_to_string(res.value()).c_str());
|
||||
g_assert_true(res.value() == paths[i].flags);
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ test_determine_target_ok(void)
|
||||
std::string old_path;
|
||||
std::string root_maildir;
|
||||
std::string target_maildir;
|
||||
MessageFlags new_flags;
|
||||
Flags new_flags;
|
||||
bool new_name;
|
||||
std::string expected;
|
||||
};
|
||||
@ -223,7 +223,7 @@ test_determine_target_ok(void)
|
||||
"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
"/home/foo/Maildir",
|
||||
{},
|
||||
MessageFlags::Seen | MessageFlags::Passed,
|
||||
Flags::Seen | Flags::Passed,
|
||||
false,
|
||||
"/home/foo/Maildir/test/cur/123456:2,PS"
|
||||
},
|
||||
@ -232,7 +232,7 @@ test_determine_target_ok(void)
|
||||
"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
"/home/foo/Maildir",
|
||||
{},
|
||||
MessageFlags::New,
|
||||
Flags::New,
|
||||
false,
|
||||
"/home/foo/Maildir/test/new/123456"
|
||||
},
|
||||
@ -241,7 +241,7 @@ test_determine_target_ok(void)
|
||||
"/home/foo/Maildir/test/cur/123456",
|
||||
"/home/foo/Maildir",
|
||||
{},
|
||||
MessageFlags::Seen | MessageFlags::Flagged,
|
||||
Flags::Seen | Flags::Flagged,
|
||||
false,
|
||||
"/home/foo/Maildir/test/cur/123456:2,FS"
|
||||
},
|
||||
@ -250,7 +250,7 @@ test_determine_target_ok(void)
|
||||
"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
"/home/foo/Maildir",
|
||||
"/test2",
|
||||
MessageFlags::Flagged | MessageFlags::Replied,
|
||||
Flags::Flagged | Flags::Replied,
|
||||
false,
|
||||
"/home/foo/Maildir/test2/cur/123456:2,FR"
|
||||
},
|
||||
@ -258,7 +258,7 @@ test_determine_target_ok(void)
|
||||
"/home/foo/Maildir/test/new/123456",
|
||||
"/home/foo/Maildir",
|
||||
{},
|
||||
MessageFlags::None,
|
||||
Flags::None,
|
||||
false,
|
||||
"/home/foo/Maildir/test/cur/123456:2,"
|
||||
},
|
||||
@ -290,157 +290,157 @@ test_determine_target_ok(void)
|
||||
// static void
|
||||
// test_mu_maildir_determine_target(void)
|
||||
// {
|
||||
// int i;
|
||||
// int i;
|
||||
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// MessageFlags flags;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::Replied,
|
||||
// "/home/foo/Maildir/test/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::New,
|
||||
// "/home/foo/Maildir/test/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456:2,FR",
|
||||
// (MessageFlags::Seen | MessageFlags::Replied),
|
||||
// "/home/foo/Maildir/test/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (MessageFlags::Seen | MessageFlags::Flagged | MessageFlags::Passed),
|
||||
// "/home/foo/Maildir/test/cur/1313038887_0.697:2,FPS"},
|
||||
// {"/home/djcb/Maildir/trash/new/1312920597.2206_16.cthulhu",
|
||||
// MessageFlags::Seen,
|
||||
// "/home/djcb/Maildir/trash/cur/1312920597.2206_16.cthulhu:2,S"}};
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// Flags flags;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::Replied,
|
||||
// "/home/foo/Maildir/test/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::New,
|
||||
// "/home/foo/Maildir/test/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456:2,FR",
|
||||
// (Flags::Seen | Flags::Replied),
|
||||
// "/home/foo/Maildir/test/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (Flags::Seen | Flags::Flagged | Flags::Passed),
|
||||
// "/home/foo/Maildir/test/cur/1313038887_0.697:2,FPS"},
|
||||
// {"/home/djcb/Maildir/trash/new/1312920597.2206_16.cthulhu",
|
||||
// Flags::Seen,
|
||||
// "/home/djcb/Maildir/trash/cur/1312920597.2206_16.cthulhu:2,S"}};
|
||||
|
||||
// for (i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// const auto res{mu_maildir_determine_target(paths[i].oldpath,
|
||||
// "/home/foo/Maildir",
|
||||
// {},
|
||||
// paths[i].flags, false)};
|
||||
// g_assert_true(res && res.value() == paths[i].newpath);
|
||||
// char *newbase = g_path_get_basename(newpath->c_str());
|
||||
// assert_matches_regexp(newbase,
|
||||
// "\\d+\\."
|
||||
// "[[:xdigit:]]{16}\\."
|
||||
// "[[:alnum:]][[:alnum:]-]+(:2,.*)?");
|
||||
// g_free(newbase);
|
||||
// }
|
||||
// for (i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// const auto res{mu_maildir_determine_target(paths[i].oldpath,
|
||||
// "/home/foo/Maildir",
|
||||
// {},
|
||||
// paths[i].flags, false)};
|
||||
// g_assert_true(res && res.value() == paths[i].newpath);
|
||||
// char *newbase = g_path_get_basename(newpath->c_str());
|
||||
// assert_matches_regexp(newbase,
|
||||
// "\\d+\\."
|
||||
// "[[:xdigit:]]{16}\\."
|
||||
// "[[:alnum:]][[:alnum:]-]+(:2,.*)?");
|
||||
// g_free(newbase);
|
||||
// }
|
||||
// }
|
||||
|
||||
// static void
|
||||
// test_mu_maildir_get_new_path_01(void)
|
||||
// {
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// MessageFlags flags;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::Replied,
|
||||
// "/home/foo/Maildir/test/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::New,
|
||||
// "/home/foo/Maildir/test/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456:2,FR",
|
||||
// (MessageFlags::Seen | MessageFlags::Replied),
|
||||
// "/home/foo/Maildir/test/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (MessageFlags::Seen | MessageFlags::Flagged | MessageFlags::Passed),
|
||||
// "/home/foo/Maildir/test/cur/1313038887_0.697:2,FPS"},
|
||||
// {"/home/djcb/Maildir/trash/new/1312920597.2206_16.cthulhu",
|
||||
// MessageFlags::Seen,
|
||||
// "/home/djcb/Maildir/trash/cur/1312920597.2206_16.cthulhu:2,S"}};
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// Flags flags;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::Replied,
|
||||
// "/home/foo/Maildir/test/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::New,
|
||||
// "/home/foo/Maildir/test/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456:2,FR",
|
||||
// (Flags::Seen | Flags::Replied),
|
||||
// "/home/foo/Maildir/test/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (Flags::Seen | Flags::Flagged | Flags::Passed),
|
||||
// "/home/foo/Maildir/test/cur/1313038887_0.697:2,FPS"},
|
||||
// {"/home/djcb/Maildir/trash/new/1312920597.2206_16.cthulhu",
|
||||
// Flags::Seen,
|
||||
// "/home/djcb/Maildir/trash/cur/1312920597.2206_16.cthulhu:2,S"}};
|
||||
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// const auto newpath{mu_maildir_determine_target(
|
||||
// paths[i].oldpath,
|
||||
// "/home/foo/maildir",
|
||||
// {}, paths[i].flags, false)};
|
||||
// g_assert_true(newpath.has_value());
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// const auto newpath{mu_maildir_determine_target(
|
||||
// paths[i].oldpath,
|
||||
// "/home/foo/maildir",
|
||||
// {}, paths[i].flags, false)};
|
||||
// g_assert_true(newpath.has_value());
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// }
|
||||
|
||||
// static void
|
||||
// test_mu_maildir_get_new_path_02(void)
|
||||
// {
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// MessageFlags flags;
|
||||
// std::string targetdir;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::Replied,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::New,
|
||||
// "/home/bar/Maildir/coffee",
|
||||
// "/home/bar/Maildir/coffee/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456",
|
||||
// (MessageFlags::Seen | MessageFlags::Replied),
|
||||
// "/home/cuux/Maildir/tea",
|
||||
// "/home/cuux/Maildir/tea/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (MessageFlags::Seen | MessageFlags::Flagged | MessageFlags::Passed),
|
||||
// "/home/boy/Maildir/stuff",
|
||||
// "/home/boy/Maildir/stuff/cur/1313038887_0.697:2,FPS"}};
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// Flags flags;
|
||||
// std::string targetdir;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::Replied,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::New,
|
||||
// "/home/bar/Maildir/coffee",
|
||||
// "/home/bar/Maildir/coffee/new/123456"},
|
||||
// {"/home/foo/Maildir/test/new/123456",
|
||||
// (Flags::Seen | Flags::Replied),
|
||||
// "/home/cuux/Maildir/tea",
|
||||
// "/home/cuux/Maildir/tea/cur/123456:2,RS"},
|
||||
// {"/home/foo/Maildir/test/new/1313038887_0.697:2,",
|
||||
// (Flags::Seen | Flags::Flagged | Flags::Passed),
|
||||
// "/home/boy/Maildir/stuff",
|
||||
// "/home/boy/Maildir/stuff/cur/1313038887_0.697:2,FPS"}};
|
||||
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// auto newpath{mu_maildir_determine_target(paths[i].oldpath,
|
||||
// paths[i].targetdir,
|
||||
// paths[i].flags,
|
||||
// false)};
|
||||
// g_assert_true(newpath.has_value());
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// auto newpath{mu_maildir_determine_target(paths[i].oldpath,
|
||||
// paths[i].targetdir,
|
||||
// paths[i].flags,
|
||||
// false)};
|
||||
// g_assert_true(newpath.has_value());
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// }
|
||||
|
||||
// static void
|
||||
// test_mu_maildir_get_new_path_custom(void)
|
||||
// {
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// MessageFlags flags;
|
||||
// std::string targetdir;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// MessageFlags::Replied,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,hFeRllo123",
|
||||
// MessageFlags::Flagged,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,Fhello123"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,abc",
|
||||
// MessageFlags::Passed,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,Pabc"}};
|
||||
// struct {
|
||||
// std::string oldpath;
|
||||
// Flags flags;
|
||||
// std::string targetdir;
|
||||
// std::string newpath;
|
||||
// } paths[] = {{"/home/foo/Maildir/test/cur/123456:2,FR",
|
||||
// Flags::Replied,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,R"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,hFeRllo123",
|
||||
// Flags::Flagged,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,Fhello123"},
|
||||
// {"/home/foo/Maildir/test/cur/123456:2,abc",
|
||||
// Flags::Passed,
|
||||
// "/home/foo/Maildir/blabla",
|
||||
// "/home/foo/Maildir/blabla/cur/123456:2,Pabc"}};
|
||||
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// auto newpath{mu_maildir_get_new_path(paths[i].oldpath,
|
||||
// paths[i].targetdir,
|
||||
// paths[i].flags,
|
||||
// FALSE)};
|
||||
// g_assert_true(newpath);
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// for (int i = 0; i != G_N_ELEMENTS(paths); ++i) {
|
||||
// auto newpath{mu_maildir_get_new_path(paths[i].oldpath,
|
||||
// paths[i].targetdir,
|
||||
// paths[i].flags,
|
||||
// FALSE)};
|
||||
// g_assert_true(newpath);
|
||||
// g_assert_true(*newpath == paths[i].newpath);
|
||||
// }
|
||||
// }
|
||||
|
||||
// static void
|
||||
// test_mu_maildir_from_path(void)
|
||||
// {
|
||||
// unsigned u;
|
||||
// unsigned u;
|
||||
|
||||
// struct {
|
||||
// std::string path, exp;
|
||||
// } cases[] = {{"/home/foo/Maildir/test/cur/123456:2,FR", "/home/foo/Maildir/test"},
|
||||
// {"/home/foo/Maildir/lala/new/1313038887_0.697:2,", "/home/foo/Maildir/lala"}};
|
||||
// struct {
|
||||
// std::string path, exp;
|
||||
// } cases[] = {{"/home/foo/Maildir/test/cur/123456:2,FR", "/home/foo/Maildir/test"},
|
||||
// {"/home/foo/Maildir/lala/new/1313038887_0.697:2,", "/home/foo/Maildir/lala"}};
|
||||
|
||||
// for (u = 0; u != G_N_ELEMENTS(cases); ++u) {
|
||||
// auto mdir{mu_maildir_from_path(cases[u].path)};
|
||||
// g_assert_true(mdir.has_value());
|
||||
// g_assert_true(*mdir == cases[u].exp);
|
||||
// }
|
||||
// for (u = 0; u != G_N_ELEMENTS(cases); ++u) {
|
||||
// auto mdir{mu_maildir_from_path(cases[u].path)};
|
||||
// g_assert_true(mdir.has_value());
|
||||
// g_assert_true(*mdir == cases[u].exp);
|
||||
// }
|
||||
// }
|
||||
|
||||
int
|
||||
|
||||
@ -49,8 +49,8 @@ get_msg(const char* path)
|
||||
|
||||
if (!msg) {
|
||||
g_printerr("failed to load %s: %s\n",
|
||||
path,
|
||||
err ? err->message : "something went wrong");
|
||||
path,
|
||||
err ? err->message : "something went wrong");
|
||||
g_clear_error(&err);
|
||||
g_assert(0);
|
||||
}
|
||||
@ -70,22 +70,22 @@ test_mu_msg_01(void)
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg), ==, "gcc include search order");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "Mickey Mouse <anon@example.com>");
|
||||
g_assert_cmpstr(mu_msg_get_msgid(msg),
|
||||
==,
|
||||
"3BE9E6535E3029448670913581E7A1A20D852173@"
|
||||
"emss35m06.us.lmco.com");
|
||||
==,
|
||||
"3BE9E6535E3029448670913581E7A1A20D852173@"
|
||||
"emss35m06.us.lmco.com");
|
||||
g_assert_cmpstr(mu_msg_get_header(msg, "Mailing-List"),
|
||||
==,
|
||||
"contact gcc-help-help@gcc.gnu.org; run by ezmlm");
|
||||
g_assert_true(mu_msg_get_prio(msg) == Mu::MessagePriority::Normal);
|
||||
==,
|
||||
"contact gcc-help-help@gcc.gnu.org; run by ezmlm");
|
||||
g_assert_true(mu_msg_get_prio(msg) == Priority::Normal);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 1217530645);
|
||||
|
||||
|
||||
const auto contacts{mu_msg_get_contacts(msg)};
|
||||
g_assert_cmpuint(contacts.size(), == , 2);
|
||||
g_assert_true(contacts[0].name == "Mickey Mouse");
|
||||
g_assert_true(contacts[0].email == "anon@example.com");
|
||||
g_assert_true(contacts[1].name == "Donald Duck");
|
||||
g_assert_true(contacts[1].email == "gcc-help@gcc.gnu.org");
|
||||
|
||||
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ test_mu_msg_02(void)
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "anon@example.com");
|
||||
g_assert_cmpstr(mu_msg_get_msgid(msg), ==, "r6bpm5-6n6.ln1@news.ducksburg.com");
|
||||
g_assert_cmpstr(mu_msg_get_header(msg, "Errors-To"),
|
||||
==,
|
||||
"help-gnu-emacs-bounces+xxxx.klub=gmail.com@gnu.org");
|
||||
==,
|
||||
"help-gnu-emacs-bounces+xxxx.klub=gmail.com@gnu.org");
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::Low);
|
||||
== Priority::Low);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 1218051515);
|
||||
|
||||
const auto contacts{mu_msg_get_contacts(msg)};
|
||||
@ -114,8 +114,8 @@ test_mu_msg_02(void)
|
||||
g_assert_true(contacts[1].name.empty());
|
||||
g_assert_true(contacts[1].email == "help-gnu-emacs@gnu.org");
|
||||
|
||||
g_print("flags: %s\n", Mu::message_flags_to_string(mu_msg_get_flags(msg)).c_str());
|
||||
g_assert_true(mu_msg_get_flags(msg) == (MessageFlags::Seen|MessageFlags::MailingList));
|
||||
g_print("flags: %s\n", Mu::flags_to_string(mu_msg_get_flags(msg)).c_str());
|
||||
g_assert_true(mu_msg_get_flags(msg) == (Flags::Seen|Flags::MailingList));
|
||||
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
@ -131,11 +131,11 @@ test_mu_msg_03(void)
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg), ==, "Greetings from Lothlórien");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "Frodo Baggins <frodo@example.com>");
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::Normal);
|
||||
== Priority::Normal);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 0);
|
||||
g_assert_cmpstr(mu_msg_get_body_text(msg, MU_MSG_OPTION_NONE),
|
||||
==,
|
||||
"\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n");
|
||||
==,
|
||||
"\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n");
|
||||
|
||||
params = mu_msg_get_body_text_content_type_parameters(msg, MU_MSG_OPTION_NONE);
|
||||
g_assert_cmpuint(g_slist_length((GSList*)params), ==, 2);
|
||||
@ -143,7 +143,7 @@ test_mu_msg_03(void)
|
||||
g_assert_cmpstr((char*)params->data, ==, "charset");
|
||||
params = g_slist_next(params);
|
||||
g_assert_cmpstr((char*)params->data, ==, "UTF-8");
|
||||
g_assert_true(mu_msg_get_flags(msg) == (MessageFlags::Unread));
|
||||
g_assert_true(mu_msg_get_flags(msg) == (Flags::Unread));
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
|
||||
@ -157,13 +157,13 @@ test_mu_msg_04(void)
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg), ==, "pics for you");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "Sitting Bull <sb@example.com>");
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::Normal);
|
||||
== Priority::Normal);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 0);
|
||||
g_assert_true(mu_msg_get_flags(msg) ==
|
||||
(MessageFlags::HasAttachment|MessageFlags::Unread));
|
||||
(Flags::HasAttachment|Flags::Unread));
|
||||
|
||||
g_assert_true(mu_msg_get_flags(msg) ==
|
||||
(MessageFlags::HasAttachment|MessageFlags::Unread));
|
||||
(Flags::HasAttachment|Flags::Unread));
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ test_mu_msg_multimime(void)
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg), ==, "multimime");
|
||||
g_assert_cmpstr(mu_msg_get_body_text(msg, MU_MSG_OPTION_NONE), ==, "abcdef");
|
||||
g_assert_true(mu_msg_get_flags(msg) ==
|
||||
(MessageFlags::HasAttachment|MessageFlags::Flagged|MessageFlags::Seen));
|
||||
(Flags::HasAttachment|Flags::Flagged|Flags::Seen));
|
||||
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
@ -189,19 +189,19 @@ test_mu_msg_flags(void)
|
||||
|
||||
struct {
|
||||
const char* path;
|
||||
MessageFlags flags;
|
||||
Flags flags;
|
||||
} msgflags[] = {{MU_TESTMAILDIR4 "/multimime!2,FS",
|
||||
(MessageFlags::Flagged | MessageFlags::Seen |
|
||||
MessageFlags::HasAttachment)},
|
||||
{MU_TESTMAILDIR4 "/special!2,Sabc",
|
||||
(MessageFlags::Seen|MessageFlags::HasAttachment)}
|
||||
(Flags::Flagged | Flags::Seen |
|
||||
Flags::HasAttachment)},
|
||||
{MU_TESTMAILDIR4 "/special!2,Sabc",
|
||||
(Flags::Seen|Flags::HasAttachment)}
|
||||
};
|
||||
|
||||
for (u = 0; u != G_N_ELEMENTS(msgflags); ++u) {
|
||||
MuMsg* msg;
|
||||
g_assert((msg = get_msg(msgflags[u].path)));
|
||||
const auto flags{mu_msg_get_flags(msg)};
|
||||
//g_print("flags: %s\n", Mu::message_flags_to_string(flags).c_str());
|
||||
//g_print("flags: %s\n", Mu::flags_to_string(flags).c_str());
|
||||
g_assert_true(flags == msgflags[u].flags);
|
||||
mu_msg_unref(msg);
|
||||
}
|
||||
@ -217,7 +217,7 @@ test_mu_msg_umlaut(void)
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg), ==, "Motörhead");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "Mü <testmu@testmu.xx>");
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::Normal);
|
||||
== Priority::Normal);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 0);
|
||||
|
||||
mu_msg_unref(msg);
|
||||
@ -284,17 +284,17 @@ test_mu_msg_references_many(void)
|
||||
unsigned u;
|
||||
const GSList *refs, *cur;
|
||||
const char* expt_refs[] = {
|
||||
"e9065dac-13c1-4103-9e31-6974ca232a89@t15g2000prt.googlegroups.com",
|
||||
"87hbblwelr.fsf@sapphire.mobileactivedefense.com",
|
||||
"pql248-4va.ln1@wilbur.25thandClement.com",
|
||||
"ikns6r$li3$1@Iltempo.Update.UU.SE",
|
||||
"8762s0jreh.fsf@sapphire.mobileactivedefense.com",
|
||||
"ikqqp1$jv0$1@Iltempo.Update.UU.SE",
|
||||
"87hbbjc5jt.fsf@sapphire.mobileactivedefense.com",
|
||||
"ikr0na$lru$1@Iltempo.Update.UU.SE",
|
||||
"tO8cp.1228$GE6.370@news.usenetserver.com",
|
||||
"ikr6ks$nlf$1@Iltempo.Update.UU.SE",
|
||||
"8ioh48-8mu.ln1@leafnode-msgid.gclare.org.uk"};
|
||||
"e9065dac-13c1-4103-9e31-6974ca232a89@t15g2000prt.googlegroups.com",
|
||||
"87hbblwelr.fsf@sapphire.mobileactivedefense.com",
|
||||
"pql248-4va.ln1@wilbur.25thandClement.com",
|
||||
"ikns6r$li3$1@Iltempo.Update.UU.SE",
|
||||
"8762s0jreh.fsf@sapphire.mobileactivedefense.com",
|
||||
"ikqqp1$jv0$1@Iltempo.Update.UU.SE",
|
||||
"87hbbjc5jt.fsf@sapphire.mobileactivedefense.com",
|
||||
"ikr0na$lru$1@Iltempo.Update.UU.SE",
|
||||
"tO8cp.1228$GE6.370@news.usenetserver.com",
|
||||
"ikr6ks$nlf$1@Iltempo.Update.UU.SE",
|
||||
"8ioh48-8mu.ln1@leafnode-msgid.gclare.org.uk"};
|
||||
|
||||
msg = get_msg(MU_TESTMAILDIR2 "/bar/cur/181736.eml");
|
||||
refs = mu_msg_get_references(msg);
|
||||
@ -321,11 +321,11 @@ test_mu_msg_tags(void)
|
||||
|
||||
g_assert_cmpstr(mu_msg_get_to(msg), ==, "Julius Caesar <jc@example.com>");
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg),
|
||||
==,
|
||||
"Fere libenter homines id quod volunt credunt");
|
||||
==,
|
||||
"Fere libenter homines id quod volunt credunt");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "John Milton <jm@example.com>");
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::High);
|
||||
== Priority::High);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 1217530645);
|
||||
|
||||
tags = mu_msg_get_tags(msg);
|
||||
@ -348,31 +348,31 @@ test_mu_msg_comp_unix_programmer(void)
|
||||
msg = get_msg(MU_TESTMAILDIR4 "/181736.eml");
|
||||
g_assert_cmpstr(mu_msg_get_to(msg), ==, NULL);
|
||||
g_assert_cmpstr(mu_msg_get_subject(msg),
|
||||
==,
|
||||
"Re: Are writes \"atomic\" to readers of the file?");
|
||||
==,
|
||||
"Re: Are writes \"atomic\" to readers of the file?");
|
||||
g_assert_cmpstr(mu_msg_get_from(msg), ==, "Jimbo Foobarcuux <jimbo@slp53.sl.home>");
|
||||
g_assert_cmpstr(mu_msg_get_msgid(msg), ==, "oktdp.42997$Te.22361@news.usenetserver.com");
|
||||
|
||||
refs = mu_str_from_list(mu_msg_get_references(msg), ',');
|
||||
g_assert_cmpstr(refs,
|
||||
==,
|
||||
"e9065dac-13c1-4103-9e31-6974ca232a89@t15g2000prt"
|
||||
".googlegroups.com,"
|
||||
"87hbblwelr.fsf@sapphire.mobileactivedefense.com,"
|
||||
"pql248-4va.ln1@wilbur.25thandClement.com,"
|
||||
"ikns6r$li3$1@Iltempo.Update.UU.SE,"
|
||||
"8762s0jreh.fsf@sapphire.mobileactivedefense.com,"
|
||||
"ikqqp1$jv0$1@Iltempo.Update.UU.SE,"
|
||||
"87hbbjc5jt.fsf@sapphire.mobileactivedefense.com,"
|
||||
"ikr0na$lru$1@Iltempo.Update.UU.SE,"
|
||||
"tO8cp.1228$GE6.370@news.usenetserver.com,"
|
||||
"ikr6ks$nlf$1@Iltempo.Update.UU.SE,"
|
||||
"8ioh48-8mu.ln1@leafnode-msgid.gclare.org.uk");
|
||||
==,
|
||||
"e9065dac-13c1-4103-9e31-6974ca232a89@t15g2000prt"
|
||||
".googlegroups.com,"
|
||||
"87hbblwelr.fsf@sapphire.mobileactivedefense.com,"
|
||||
"pql248-4va.ln1@wilbur.25thandClement.com,"
|
||||
"ikns6r$li3$1@Iltempo.Update.UU.SE,"
|
||||
"8762s0jreh.fsf@sapphire.mobileactivedefense.com,"
|
||||
"ikqqp1$jv0$1@Iltempo.Update.UU.SE,"
|
||||
"87hbbjc5jt.fsf@sapphire.mobileactivedefense.com,"
|
||||
"ikr0na$lru$1@Iltempo.Update.UU.SE,"
|
||||
"tO8cp.1228$GE6.370@news.usenetserver.com,"
|
||||
"ikr6ks$nlf$1@Iltempo.Update.UU.SE,"
|
||||
"8ioh48-8mu.ln1@leafnode-msgid.gclare.org.uk");
|
||||
g_free(refs);
|
||||
|
||||
//"jimbo@slp53.sl.home (Jimbo Foobarcuux)";
|
||||
g_assert_true(mu_msg_get_prio(msg) /* 'low' */
|
||||
== Mu::MessagePriority::Normal);
|
||||
== Priority::Normal);
|
||||
g_assert_cmpuint(mu_msg_get_date(msg), ==, 1299603860);
|
||||
|
||||
mu_msg_unref(msg);
|
||||
@ -381,9 +381,9 @@ test_mu_msg_comp_unix_programmer(void)
|
||||
static void
|
||||
test_mu_str_prio_01(void)
|
||||
{
|
||||
g_assert_true(message_priority_name(Mu::MessagePriority::Low) == "low");
|
||||
g_assert_true(message_priority_name(Mu::MessagePriority::Normal) == "normal");
|
||||
g_assert_true(message_priority_name(Mu::MessagePriority::High) == "high");
|
||||
g_assert_true(priority_name(Priority::Low) == "low");
|
||||
g_assert_true(priority_name(Priority::Normal) == "normal");
|
||||
g_assert_true(priority_name(Priority::High) == "high");
|
||||
}
|
||||
|
||||
G_GNUC_UNUSED static gboolean
|
||||
@ -400,9 +400,9 @@ test_mu_str_display_contact(void)
|
||||
const char* word;
|
||||
const char* disp;
|
||||
} words[] = {{"\"Foo Bar\" <aap@noot.mies>", "Foo Bar"},
|
||||
{"Foo Bar <aap@noot.mies>", "Foo Bar"},
|
||||
{"<aap@noot.mies>", "aap@noot.mies"},
|
||||
{"foo@bar.nl", "foo@bar.nl"}};
|
||||
{"Foo Bar <aap@noot.mies>", "Foo Bar"},
|
||||
{"<aap@noot.mies>", "aap@noot.mies"},
|
||||
{"foo@bar.nl", "foo@bar.nl"}};
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i)
|
||||
g_assert_cmpstr(mu_str_display_contact_s(words[i].word), ==, words[i].disp);
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "test-mu-common.hh"
|
||||
|
||||
using namespace Mu;
|
||||
using namespace Mu::Message;
|
||||
|
||||
static void
|
||||
test_query()
|
||||
|
||||
Reference in New Issue
Block a user