Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 23560 invoked from network); 4 Jan 2009 07:22:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jan 2009 07:22:44 -0000 Received: (qmail 91461 invoked by uid 500); 4 Jan 2009 07:22:44 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 91429 invoked by uid 500); 4 Jan 2009 07:22:43 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 91420 invoked by uid 99); 4 Jan 2009 07:22:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 23:22:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2009 07:22:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E3E1C2388988; Sat, 3 Jan 2009 23:22:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r731187 - /couchdb/trunk/share/www/script/couch_tests.js Date: Sun, 04 Jan 2009 07:22:22 -0000 To: commits@couchdb.apache.org From: jchris@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090104072222.E3E1C2388988@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jchris Date: Sat Jan 3 23:22:22 2009 New Revision: 731187 URL: http://svn.apache.org/viewvc?rev=731187&view=rev Log: better E4X escaping in tests, dropped JS heredoc Modified: couchdb/trunk/share/www/script/couch_tests.js Modified: couchdb/trunk/share/www/script/couch_tests.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_tests.js?rev=731187&r1=731186&r2=731187&view=diff ============================================================================== --- couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original) +++ couchdb/trunk/share/www/script/couch_tests.js [utf-8] Sat Jan 3 23:22:22 2009 @@ -2059,15 +2059,14 @@ json : req } }), - "xml-type" : [ - 'function(doc, req) { ', - ' return { ', - ' "headers" : { ', - ' "Content-Type" : "application/xml" ', - ' }, ', - ' "body" : ', - ' } ', - '}'].join('\n'), + "xml-type" : stringFun(function(doc, req) { + return { + "headers" : { + "Content-Type" : "application/xml" + }, + "body" : new XML('') + } + }), "no-set-etag" : stringFun(function(doc, req) { return { headers : { @@ -2104,29 +2103,35 @@ }; } }), - "respondWith" : [ - 'function(doc, req) { ', - ' registerType("foo", "application/foo","application/x-foo");', - ' return respondWith(req, { ', - ' html : function() { ', - ' return { ', - ' body:"Ha ha, you said \\"" + doc.word + "\\"." ', - ' }; ', - ' }, ', - ' xml : function() { ', - ' return { ', - ' body: ', - ' }; ', - ' }, ', - ' foo : function() { ', - ' return { ', - ' body: "foofoo" ', - ' }; ', - ' }, ', - ' fallback : "html" ', - ' }); ', - '}'].join('\n') - } + "respondWith" : stringFun(function(doc, req) { + registerType("foo", "application/foo","application/x-foo"); + return respondWith(req, { + html : function() { + return { + body:"Ha ha, you said \"" + doc.word + "\"." + }; + }, + xml : function() { + var xml = new XML(''); + // becase Safari can't stand to see that dastardly + // E4X outside of a string. + this.eval('xml.node.@foo = doc.word'); + return { + headers : { + "Content-Type" : "application/xml", + }, + body: xml + }; + }, + foo : function() { + return { + body: "foofoo" + }; + }, + fallback : "html" + }); + }) + } }; T(db.save(designDoc).ok); @@ -2277,6 +2282,7 @@ } }); T(xhr.getResponseHeader("Content-Type") == "application/xml"); + T(xhr.responseText.match(/node/)); T(xhr.responseText.match(/plankton/)); // registering types works