summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-01-02 02:00:33 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-01-02 02:00:33 +0000
commit2886280c57cb77b6e7f2bac544af5b8c23164816 (patch)
treeff59fdfe707f45a9888a3a0c53560211cbbbacd2 /share/www
parenta0da70849a2ede47340e75c62b92ddfe7b89829e (diff)
test runner is back up (thanks davisp), and tests pass in safari again (e4x syntax fix)
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@730656 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/couch_tests.js87
1 files changed, 47 insertions, 40 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 5a642f33..c0f909ad 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -2034,43 +2034,49 @@ var tests = {
db.deleteDb();
db.createDb();
if (debug) debugger;
+
+ function stringFun(fun) {
+ var string = fun.toSource ? fun.toSource() : "(" + fun.toString() + ")";
+ return string;
+ }
var designDoc = {
_id:"_design/template",
language: "javascript",
forms: {
- "hello" : (function() {
+ "hello" : stringFun(function() {
return {
body : "Hello World"
};
- }).toString(),
- "just-name" : (function(doc, req) {
+ }),
+ "just-name" : stringFun(function(doc, req) {
return {
body : "Just " + doc.name
};
- }).toString(),
- "req-info" : (function(doc, req) {
+ }),
+ "req-info" : stringFun(function(doc, req) {
return {
json : req
}
- }).toString(),
- "xml-type" : (function(doc, req) {
- return {
- headers : {
- "Content-Type" : "application/xml"
- },
- "body" : <xml><node foo="bar"/></xml>
- }
- }).toString(),
- "no-set-etag" : (function(doc, req) {
+ }),
+ "xml-type" : [
+ 'function(doc, req) { ',
+ ' return { ',
+ ' "headers" : { ',
+ ' "Content-Type" : "application/xml" ',
+ ' }, ',
+ ' "body" : <xml><node foo="bar"/></xml>',
+ ' } ',
+ '}'].join('\n'),
+ "no-set-etag" : stringFun(function(doc, req) {
return {
headers : {
"Etag" : "skipped"
},
"body" : "something"
}
- }).toString(),
- "accept-switch" : (function(doc, req) {
+ }),
+ "accept-switch" : stringFun(function(doc, req) {
if (req.headers["Accept"].match(/image/)) {
return {
// a 16x16 px version of the CouchDB logo
@@ -2097,29 +2103,30 @@ var tests = {
}
};
}
- }).toString(),
- "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: <xml><node foo={doc.word}/></xml>
- };
- },
- foo : function() {
- return {
- body: "foofoo"
- };
- },
- default : "html"
- });
- }).toString()
- }
+ }),
+ "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: <xml><node foo={doc.word}/></xml> ',
+ ' }; ',
+ ' }, ',
+ ' foo : function() { ',
+ ' return { ',
+ ' body: "foofoo" ',
+ ' }; ',
+ ' }, ',
+ ' fallback : "html" ',
+ ' }); ',
+ '}'].join('\n')
+ }
};
T(db.save(designDoc).ok);