aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@src.gnome.org>2003-03-31 15:20:44 +0800
committerChris Toshok <toshok@src.gnome.org>2003-03-31 15:20:44 +0800
commit466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7 (patch)
treee0321681e70e8c88ab74fe9b50e4ecbaac88a038 /addressbook
parent06ea0b6cb33dff027bb23dde7d0ae19b1ff05720 (diff)
downloadgsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar.gz
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar.bz2
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar.lz
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar.xz
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.tar.zst
gsoc2013-evolution-466a9db478a2ec76cf92bc3bf5087d2fca2d7cb7.zip
add vcard tests
svn path=/trunk/; revision=20590
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/backend/ebook/tests/.cvsignore2
-rw-r--r--addressbook/backend/ebook/tests/Makefile.am1
-rw-r--r--addressbook/backend/ebook/tests/vcard/.cvsignore3
-rw-r--r--addressbook/backend/ebook/tests/vcard/1.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/10.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/2.vcf10
-rw-r--r--addressbook/backend/ebook/tests/vcard/3.vcf13
-rw-r--r--addressbook/backend/ebook/tests/vcard/4.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/5.vcf32
-rw-r--r--addressbook/backend/ebook/tests/vcard/6.vcf12
-rw-r--r--addressbook/backend/ebook/tests/vcard/7.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/8.vcf11
-rw-r--r--addressbook/backend/ebook/tests/vcard/9.vcf9
-rw-r--r--addressbook/backend/ebook/tests/vcard/Makefile.am6
-rw-r--r--addressbook/backend/ebook/tests/vcard/README41
-rw-r--r--addressbook/backend/ebook/tests/vcard/dump-vcard.c32
16 files changed, 218 insertions, 0 deletions
diff --git a/addressbook/backend/ebook/tests/.cvsignore b/addressbook/backend/ebook/tests/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/addressbook/backend/ebook/tests/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/addressbook/backend/ebook/tests/Makefile.am b/addressbook/backend/ebook/tests/Makefile.am
new file mode 100644
index 0000000000..f17f979485
--- /dev/null
+++ b/addressbook/backend/ebook/tests/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=vcard \ No newline at end of file
diff --git a/addressbook/backend/ebook/tests/vcard/.cvsignore b/addressbook/backend/ebook/tests/vcard/.cvsignore
new file mode 100644
index 0000000000..41d78c77a2
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+dump-vcard
diff --git a/addressbook/backend/ebook/tests/vcard/1.vcf b/addressbook/backend/ebook/tests/vcard/1.vcf
new file mode 100644
index 0000000000..308144c5f1
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/1.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/10.vcf b/addressbook/backend/ebook/tests/vcard/10.vcf
new file mode 100644
index 0000000000..4bccbe9ffb
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/10.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/2.vcf b/addressbook/backend/ebook/tests/vcard/2.vcf
new file mode 100644
index 0000000000..bdf14ea1b7
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/2.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/3.vcf b/addressbook/backend/ebook/tests/vcard/3.vcf
new file mode 100644
index 0000000000..3058716959
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/3.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/4.vcf b/addressbook/backend/ebook/tests/vcard/4.vcf
new file mode 100644
index 0000000000..46878f753b
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/4.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/5.vcf b/addressbook/backend/ebook/tests/vcard/5.vcf
new file mode 100644
index 0000000000..51bbe207a6
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/5.vcf
@@ -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=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OTED-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
+
diff --git a/addressbook/backend/ebook/tests/vcard/6.vcf b/addressbook/backend/ebook/tests/vcard/6.vcf
new file mode 100644
index 0000000000..e5e8310eb3
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/6.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/7.vcf b/addressbook/backend/ebook/tests/vcard/7.vcf
new file mode 100644
index 0000000000..fb88173032
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/7.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/8.vcf b/addressbook/backend/ebook/tests/vcard/8.vcf
new file mode 100644
index 0000000000..172d1d2c68
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/8.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/9.vcf b/addressbook/backend/ebook/tests/vcard/9.vcf
new file mode 100644
index 0000000000..7043ab8c13
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/9.vcf
@@ -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
diff --git a/addressbook/backend/ebook/tests/vcard/Makefile.am b/addressbook/backend/ebook/tests/vcard/Makefile.am
new file mode 100644
index 0000000000..ae16780095
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/Makefile.am
@@ -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`
diff --git a/addressbook/backend/ebook/tests/vcard/README b/addressbook/backend/ebook/tests/vcard/README
new file mode 100644
index 0000000000..06ae719c5e
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/README
@@ -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.
+
+----------------------
diff --git a/addressbook/backend/ebook/tests/vcard/dump-vcard.c b/addressbook/backend/ebook/tests/vcard/dump-vcard.c
new file mode 100644
index 0000000000..52dbf8a957
--- /dev/null
+++ b/addressbook/backend/ebook/tests/vcard/dump-vcard.c
@@ -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;
+}