Bug 803835 - Part 2: Regression tests for quoted fields in CSV files. r=mconley, a=Standard8.
authorMark Banner <mbanner@mozilla.com>
Fri, 02 Nov 2012 13:34:20 -0400
changeset 13536 8b72284c58b95ca4b50ac26a0f28472c3b75a0b7
parent 13535 bb4af80f294458facd0de373a311c18d2f9c7140
child 13537 4fbd531743e2de3868878820a67440c59f863cd7
push idunknown
push userunknown
push dateunknown
reviewersmconley, Standard8
bugs803835
Bug 803835 - Part 2: Regression tests for quoted fields in CSV files. r=mconley, a=Standard8.
mailnews/import/test/unit/resources/addressbook.json
mailnews/import/test/unit/resources/quote.csv
mailnews/import/test/unit/test_csv_import_quote.js
mailnews/import/test/unit/xpcshell.ini
--- a/mailnews/import/test/unit/resources/addressbook.json
+++ b/mailnews/import/test/unit/resources/addressbook.json
@@ -62,16 +62,24 @@
   ],
   "shiftjis_csv" :
   [
     {
       "DisplayName"      : "名無しの権兵衛",
       "PrimaryEmail"     : "名無しの権兵衛@host.invalid"
     }
   ],
+  "quote_csv" :
+  [
+    {
+      "DisplayName"      : "Acer America",
+      "Work Phone"       : "(800) 000-0000",
+      "Organization"     : "Acer America"
+    } 
+  ],
   "vcard_import" :
   [
     {
       "DisplayName"      : "John Doe",
       "FirstName"        : "John",
       "LastName"         : "Doe",
       "PrimaryEmail"     : "john.doe@genericemail.com"
     },
new file mode 100644
--- /dev/null
+++ b/mailnews/import/test/unit/resources/quote.csv
@@ -0,0 +1,2 @@
+First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes
+,,"Acer America",,,,,"(800) 000-0000","","","","","","","","","","","","","","","","",,,"Acer America",,,,,,,,,,
new file mode 100644
--- /dev/null
+++ b/mailnews/import/test/unit/test_csv_import_quote.js
@@ -0,0 +1,13 @@
+/**
+ * Tests importing quoted csv address books.
+ */
+function run_test()
+{
+  // Due to the import code using nsIAbManager off the main thread, we need
+  // to ensure that it is initialized before we start the main test.
+  let abMgr = MailServices.ab;
+
+  let file = do_get_file("resources/quote.csv");
+  new AbImportHelper(file, "csv", "quote",
+                     "quote_csv").beginImport();
+}
--- a/mailnews/import/test/unit/xpcshell.ini
+++ b/mailnews/import/test/unit/xpcshell.ini
@@ -1,16 +1,17 @@
 [DEFAULT]
 head = head_import.js
 tail = tail_import.js
 
 [test_bug_263304.js]
 [test_bug_437556.js]
 [test_csv_GetSample.js]
 [test_csv_import.js]
+[test_csv_import_quote.js]
 [test_ldif_import.js]
 [test_oe_settings.js]
 run-if = os == 'win'
 [test_outlook_settings.js]
 run-if = os == 'win'
 [test_shiftjis_csv.js]
 [test_utf16_csv.js]
 [test_vcard_import.js]