add vcard tests
svn path=/trunk/; revision=20590
This commit is contained in:
2
addressbook/backend/ebook/tests/.cvsignore
Normal file
2
addressbook/backend/ebook/tests/.cvsignore
Normal file
@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
1
addressbook/backend/ebook/tests/Makefile.am
Normal file
1
addressbook/backend/ebook/tests/Makefile.am
Normal file
@ -0,0 +1 @@
|
||||
SUBDIRS=vcard
|
||||
3
addressbook/backend/ebook/tests/vcard/.cvsignore
Normal file
3
addressbook/backend/ebook/tests/vcard/.cvsignore
Normal file
@ -0,0 +1,3 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
dump-vcard
|
||||
12
addressbook/backend/ebook/tests/vcard/1.vcf
Normal file
12
addressbook/backend/ebook/tests/vcard/1.vcf
Normal file
@ -0,0 +1,12 @@
|
||||
BEGIN:vCard
|
||||
VERSION:3.0
|
||||
FN:Frank Dawson
|
||||
ORG:Lotus Development Corporation
|
||||
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
|
||||
TEL;TYPE=FAX,WORK:+1-919-676-9564
|
||||
EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
|
||||
EMAIL;TYPE=INTERNET:fdawson@earthlink.net
|
||||
URL:http://home.earthlink.net/~fdawson
|
||||
END:vCard
|
||||
12
addressbook/backend/ebook/tests/vcard/10.vcf
Normal file
12
addressbook/backend/ebook/tests/vcard/10.vcf
Normal file
@ -0,0 +1,12 @@
|
||||
BEGIN:vCard
|
||||
vCard.vCard.VERSION:3.0
|
||||
vCard.FN:Frank Dawson
|
||||
vCard.ORG:Lotus Development Corporation
|
||||
vCard.ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
vCard.TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
|
||||
vCard.TEL;TYPE=FAX,WORK:+1-919-676-9564
|
||||
vCard.EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
|
||||
vCard.EMAIL;TYPE=INTERNET:fdawson@earthlink.net
|
||||
vCard.URL:http://home.earthlink.net/~fdawson
|
||||
END:vCard
|
||||
10
addressbook/backend/ebook/tests/vcard/2.vcf
Normal file
10
addressbook/backend/ebook/tests/vcard/2.vcf
Normal file
@ -0,0 +1,10 @@
|
||||
BEGIN:vCard
|
||||
VERSION:3.0
|
||||
FN:Tim Howes
|
||||
ORG:Netscape Communications Corp.
|
||||
ADR;TYPE=WORK:;;501 E. Middlefield Rd.;Mountain View;
|
||||
CA; 94043;U.S.A.
|
||||
TEL;TYPE=VOICE,MSG,WORK:+1-415-937-3419
|
||||
TEL;TYPE=FAX,WORK:+1-415-528-4164
|
||||
EMAIL;TYPE=INTERNET:howes@netscape.com
|
||||
END:vCard
|
||||
13
addressbook/backend/ebook/tests/vcard/3.vcf
Normal file
13
addressbook/backend/ebook/tests/vcard/3.vcf
Normal file
@ -0,0 +1,13 @@
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
X-EVOLUTION-FILE-AS:Friedman, Nat
|
||||
FN:Nat
|
||||
N:Friedman;Nat;D;Mr.
|
||||
ADR;POSTAL;WORK:P.O. Box 101;;;Any Town;CA;91921-1234
|
||||
TEL;WORK:617 679 1984
|
||||
TEL;CELL:123 456 7890
|
||||
EMAIL;INTERNET:nat@nat.org
|
||||
EMAIL;INTERNET:nat@ximian.com
|
||||
BDAY:1977-08-06
|
||||
UID:pas-id-3E65886900000002
|
||||
END:VCARD
|
||||
11
addressbook/backend/ebook/tests/vcard/4.vcf
Normal file
11
addressbook/backend/ebook/tests/vcard/4.vcf
Normal file
@ -0,0 +1,11 @@
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
X-EVOLUTION-FILE-AS:address, canada
|
||||
FN:canada address
|
||||
N:address;canada
|
||||
ADR;WORK:;;92 Main St. N.;Newmarket;ON;L3Y 4A1;Canada
|
||||
ADR;HOME;PREF:;;92 Main St. N.;Newmarket;ON;L3Y 4A1;Canada
|
||||
LABEL;QUOTED-PRINTABLE;WORK:92 Main St. N.=0ANewmarket, ON L3Y 4A1=0ACanada
|
||||
LABEL;QUOTED-PRINTABLE;HOME;PREF:92 Main St. N.=0ANewmarket, ON L3Y 4A1=0ACanada
|
||||
UID:pas-id-3E84C16E00000001
|
||||
END:VCARD
|
||||
32
addressbook/backend/ebook/tests/vcard/5.vcf
Normal file
32
addressbook/backend/ebook/tests/vcard/5.vcf
Normal file
@ -0,0 +1,32 @@
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
X-EVOLUTION-FILE-AS;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
FN;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
N;CHARSET=UTF-8:;十城目管理大型知座
|
||||
ADR;WORK;PREF;QUOTED-PRINTABLE;CHARSET=UTF-8:;=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=
|
||||
=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=
|
||||
=9E=8B=E7=9F=A5=E5=BA=A7;=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
LABEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;PREF:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=
|
||||
=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=
|
||||
=9E=8B=E7=9F=A5=E5=BA=A7=0A=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=
|
||||
=A4=A7=E5=9E=8B=E7=9F=A5=E5=BA=A7
|
||||
TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;VOICE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;WORK;FAX:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;HOME:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
TEL;CHARSET=UTF-8;QUOTED-PRINTABLE;CELL:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
EMAIL;INTERNET:weird@weird.com
|
||||
ORG;CHARSET=UTF-8:十城目管理大型知座
|
||||
TITLE;CHARSET=UTF-8;QUOTED-PRINTABLE:=E5=8D=81=E5=9F=8E=E7=9B=AE=E7=AE=A1=E7=90=86=E5=A4=A7=E5=9E=8B=E7=9F=A5=E5=
|
||||
=BA=A7
|
||||
UID:pas-id-3E52FE2E00000000
|
||||
END:VCARD
|
||||
|
||||
12
addressbook/backend/ebook/tests/vcard/6.vcf
Normal file
12
addressbook/backend/ebook/tests/vcard/6.vcf
Normal file
@ -0,0 +1,12 @@
|
||||
BEGIN:vCard
|
||||
VERSION:3.0
|
||||
FN:Frank Dawson
|
||||
ORG:Lotus Development Corporation
|
||||
ADR;TYPE=WORK,:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
TEL;TYPE=VOICE;MSG,WORK:+1-919-676-9515
|
||||
TEL;FAX,WORK:+1-919-676-9564
|
||||
EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
|
||||
EMAIL;TYPE=INTERNET:fdawson@earthlink.net
|
||||
URL:http://home.earthlink.net/~fdawson
|
||||
END:vCard
|
||||
11
addressbook/backend/ebook/tests/vcard/7.vcf
Normal file
11
addressbook/backend/ebook/tests/vcard/7.vcf
Normal file
@ -0,0 +1,11 @@
|
||||
VERSION:3.0
|
||||
FN:Frank Dawson
|
||||
ORG:Lotus Development Corporation
|
||||
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
|
||||
TEL;TYPE=FAX,WORK:+1-919-676-9564
|
||||
EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
|
||||
EMAIL;TYPE=INTERNET:fdawson@earthlink.net
|
||||
URL:http://home.earthlink.net/~fdawson
|
||||
END:vCard
|
||||
11
addressbook/backend/ebook/tests/vcard/8.vcf
Normal file
11
addressbook/backend/ebook/tests/vcard/8.vcf
Normal file
@ -0,0 +1,11 @@
|
||||
BEGIN:vCard
|
||||
VERSION:3.0
|
||||
FN:Frank Dawson
|
||||
ORG:Lotus Development Corporation
|
||||
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
|
||||
TEL;TYPE=FAX,WORK:+1-919-676-9564
|
||||
EMAIL;TYPE=INTERNET,PREF:Frank_Dawson@Lotus.com
|
||||
EMAIL;TYPE=INTERNET:fdawson@earthlink.net
|
||||
URL:http://home.earthlink.net/~fdawson
|
||||
9
addressbook/backend/ebook/tests/vcard/9.vcf
Normal file
9
addressbook/backend/ebook/tests/vcard/9.vcf
Normal file
@ -0,0 +1,9 @@
|
||||
BEGIN:vCard
|
||||
VERSION:3.0
|
||||
FN:Frank Dawson
|
||||
ORG:Lotus Development Corporation
|
||||
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
|
||||
;Raleigh;NC;27613-3502;U.S.A.
|
||||
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
|
||||
TEL;TYPE=FAX,WORK:+1-919-676-9564
|
||||
E
|
||||
6
addressbook/backend/ebook/tests/vcard/Makefile.am
Normal file
6
addressbook/backend/ebook/tests/vcard/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
CFLAGS=-I$(srcdir)/../.. `pkg-config --cflags gobject-2.0`
|
||||
|
||||
noinst_PROGRAMS=dump-vcard
|
||||
|
||||
dump_vcard_LDFLAGS=$(top_builddir)/addressbook/backend/ebook/libevcard.la `pkg-config --libs gobject-2.0`
|
||||
41
addressbook/backend/ebook/tests/vcard/README
Normal file
41
addressbook/backend/ebook/tests/vcard/README
Normal file
@ -0,0 +1,41 @@
|
||||
This is the list of tests I've been using while writing e-vcard.c.
|
||||
The parser is all handcrafted, and it's not a validating parser by any
|
||||
stretch of the imagination. It tries very hard to deal with any
|
||||
possible input (it'll even parse rfc822 mail headers and spit out
|
||||
vCard-ish results.)
|
||||
|
||||
Test : Description
|
||||
----------------------
|
||||
|
||||
1.vcf : Frank Dawson's vCard from RFC 2426 (missing the required N
|
||||
attribute.)
|
||||
|
||||
2.vcf : Tim Howes's vCard from from RFC 2426 (missing the required N
|
||||
attribute.)
|
||||
|
||||
3.vcf : Nat's old vCard.
|
||||
|
||||
4.vcf : A vCard containing a canadian address (quoted-printable
|
||||
encoded attribute values.)
|
||||
|
||||
5.vcf : A vCard containing utf8 characters quoted-printable encoded.
|
||||
|
||||
6.vcf : A vCard with several errors in attribute parameters:
|
||||
line 5: an missing parameter value (a , with nothing after it).
|
||||
line 6: a missing parameter name when using multiple
|
||||
values. (this may not be in violation of the rfc.)
|
||||
line 7: a missing parameter name when using multiple
|
||||
values. (this may not be in violation of the rfc.)
|
||||
|
||||
7.vcf : A vCard missing its begin:vcard attribute, as well as missing
|
||||
the required N attribute.
|
||||
|
||||
8.vcf : A vCard missing its end: vcard attribute, as well as missing
|
||||
the required N attribute.
|
||||
|
||||
9.vcf : A vCard that ends (\0) in the middle of an attribute
|
||||
name/group.
|
||||
|
||||
10.vcf : A vCard with an attribute with more than 1 group specified.
|
||||
|
||||
----------------------
|
||||
32
addressbook/backend/ebook/tests/vcard/dump-vcard.c
Normal file
32
addressbook/backend/ebook/tests/vcard/dump-vcard.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "e-vcard.h"
|
||||
|
||||
FILE *fp;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
EVCard *vcard;
|
||||
GString *str = g_string_new ("");
|
||||
|
||||
if (argc < 2)
|
||||
return 0;
|
||||
|
||||
g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS);
|
||||
|
||||
fp = fopen (argv[1], "r");
|
||||
|
||||
while (!feof (fp)) {
|
||||
char buf[1024];
|
||||
if (fgets (buf, sizeof(buf), fp))
|
||||
str = g_string_append (str, buf);
|
||||
}
|
||||
|
||||
vcard = e_vcard_new_from_string (str->str);
|
||||
|
||||
e_vcard_dump_structure (vcard);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user