* add mailing list test msg for unit tests

This commit is contained in:
Dirk-Jan C. Binnema 2011-06-08 08:33:30 +03:00
parent f14de4784b
commit 9b0067aa4a
3 changed files with 76 additions and 4 deletions

View File

@ -117,5 +117,6 @@ EXTRA_DIST= \
testdir2/bar/cur/mail4 \
testdir2/bar/cur/mail5 \
testdir2/Foo/cur/mail5 \
testdir2/bar/cur/181736.eml \
testdir2/Foo/cur/arto.eml

View File

@ -1,5 +1,4 @@
/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/
/*
** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
@ -218,7 +217,7 @@ test_mu_msg_04 (void)
static void
test_mu_msg_05 (void)
test_mu_msg_umlaut (void)
{
MuMsg *msg;
@ -266,12 +265,38 @@ test_mu_msg_tags (void)
g_assert_cmpstr ((char*)tags->data,==,"paradise");
g_assert_cmpstr ((char*)tags->next->data,==,"lost");
g_assert (tags->next->next == NULL);
mu_msg_unref (msg);
}
static void
test_mu_msg_comp_unix_programmer (void)
{
MuMsg *msg;
msg = mu_msg_new_from_file (MU_TESTMAILDIR2
"bar/cur/181736.eml", NULL, NULL);
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?");
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");
//"jimbo@slp53.sl.home (Jimbo Foobarcuux)";
g_assert_cmpuint (mu_msg_get_prio(msg), /* 'low' */
==, MU_MSG_PRIO_NORMAL);
g_assert_cmpuint (mu_msg_get_date(msg),
==, 1299603860);
mu_msg_unref (msg);
}
/* static gboolean */
/* ignore_error (const char* log_domain, GLogLevelFlags log_level, const gchar* msg, */
/* gpointer user_data) */
@ -299,6 +324,10 @@ main (int argc, char *argv[])
test_mu_msg_05);
g_test_add_func ("/mu-msg/mu-msg-tags",
test_mu_msg_tags);
g_test_add_func ("/mu-msg/mu-msg-umlaut",
test_mu_msg_umlaut);
g_test_add_func ("/mu-msg/mu-msg-comp-unix-programmer",
test_mu_msg_comp_unix_programmer);
g_log_set_handler (NULL,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,

View File

@ -0,0 +1,42 @@
Path: uutiset.elisa.fi!feeder2.news.elisa.fi!feeder.erje.net!newsfeed.kamp.net!newsfeed0.kamp.net!nx02.iad01.newshosting.com!newshosting.com!post01.iad!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: jimbo@lews (Jimbo Foobarcuux)
From: jimbo@slp53.sl.home (Jimbo Foobarcuux)
Reply-To: slp53@pacbell.net
Subject: Re: Are writes "atomic" to readers of the file?
Newsgroups: comp.unix.programmer
References: <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>
Organization: UseNetServer - www.usenetserver.com
X-Complaints-To: abuse@usenetserver.com
Message-ID: <oktdp.42997$Te.22361@news.usenetserver.com>
Date: 08 Mar 2011 17:04:20 GMT
Lines: 27
Xref: uutiset.elisa.fi comp.unix.programmer:181736
John Denver <jd@clare.See-My-Signature.invalid> writes:
>Eric the Red wrote:
>
>>> There _IS_ a requirement that all reads and writes to regular files
>>> be atomic. There is also an ordering guarantee. Any implementation
>>> that doesn't provide both atomicity and ordering guarantees is broken.
>>
>> But where is it specified?
>
>The place where it is stated most explicitly is in XSH7 2.9.7
>Thread Interactions with Regular File Operations:
>
> All of the following functions shall be atomic with respect to each
> other in the effects specified in POSIX.1-2008 when they operate on
> regular files or symbolic links:
>
> [List of functions that includes read() and write()]
>
> If two threads each call one of these functions, each call shall
> either see all of the specified effects of the other call, or none
> of them.
>
And, for the purposes of this paragraph, the two threads need not be
part of the same process.
jimbo