couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r988909 - in /couchdb/trunk/share/www/script: couch_test_runner.js test/attachments.js
Date Wed, 25 Aug 2010 08:56:15 GMT
Author: rnewson
Date: Wed Aug 25 08:56:15 2010
New Revision: 988909

URL: http://svn.apache.org/viewvc?rev=988909&view=rev
Log:
fix attachments.js in Safari by treating charset case-insensitively.

Modified:
    couchdb/trunk/share/www/script/couch_test_runner.js
    couchdb/trunk/share/www/script/test/attachments.js

Modified: couchdb/trunk/share/www/script/couch_test_runner.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_test_runner.js?rev=988909&r1=988908&r2=988909&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/couch_test_runner.js (original)
+++ couchdb/trunk/share/www/script/couch_test_runner.js Wed Aug 25 08:56:15 2010
@@ -311,6 +311,11 @@ function TEquals(expected, actual, testN
     "', got '" + repr(actual) + "'", testName);
 }
 
+function TEqualsIgnoreCase(expected, actual, testName) {
+  T(equals(expected.toUpperCase(), actual.toUpperCase()), "expected '" + repr(expected) +
+    "', got '" + repr(actual) + "'", testName);
+}
+
 function equals(a,b) {
   if (a === b) return true;
   try {

Modified: couchdb/trunk/share/www/script/test/attachments.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/attachments.js?rev=988909&r1=988908&r2=988909&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/attachments.js (original)
+++ couchdb/trunk/share/www/script/test/attachments.js Wed Aug 25 08:56:15 2010
@@ -68,12 +68,12 @@ couchTests.attachments= function(debug) 
 
   T(binAttDoc2._attachments["foo.txt"] !== undefined);
   T(binAttDoc2._attachments["foo2.txt"] !== undefined);
-  T(binAttDoc2._attachments["foo2.txt"].content_type == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", binAttDoc2._attachments["foo2.txt"].content_type);
   T(binAttDoc2._attachments["foo2.txt"].length == 30);
 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc2/foo2.txt");
   T(xhr.responseText == "This is no base64 encoded text");
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   // test without rev, should fail
   var xhr = CouchDB.request("DELETE", "/test_suite_db/bin_doc2/foo2.txt");
@@ -97,7 +97,7 @@ couchTests.attachments= function(debug) 
 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc3/attachment.txt");
   T(xhr.responseText == bin_data);
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc3/attachment.txt", {
     headers:{"Content-Type":"text/plain;charset=utf-8"},
@@ -115,11 +115,11 @@ couchTests.attachments= function(debug) 
 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc3/attachment.txt");
   T(xhr.responseText == bin_data);
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc3/attachment.txt?rev=" + rev);
   T(xhr.responseText == bin_data);
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   var xhr = CouchDB.request("DELETE", "/test_suite_db/bin_doc3/attachment.txt?rev=" + rev);
   T(xhr.status == 200);
@@ -131,7 +131,7 @@ couchTests.attachments= function(debug) 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc3/attachment.txt?rev=" + rev);
   T(xhr.status == 200);
   T(xhr.responseText == bin_data);
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   // empty attachments
   var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc4/attachment.txt", {
@@ -212,7 +212,7 @@ couchTests.attachments= function(debug) 
 
   var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc5/lorem.txt");
   T(xhr.responseText == lorem);
-  T(xhr.getResponseHeader("Content-Type") == "text/plain;charset=utf-8");
+  TEqualsIgnoreCase("text/plain;charset=utf-8", xhr.getResponseHeader("Content-Type"));
 
   // test large inline attachment too
   var lorem_b64 = CouchDB.request("GET", "/_utils/script/test/lorem_b64.txt").responseText;



Mime
View raw message