couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r730656 - in /couchdb/trunk: share/server/main.js share/www/script/couch_tests.js test/runner.sh test/test.js
Date Fri, 02 Jan 2009 02:00:33 GMT
Author: jchris
Date: Thu Jan  1 18:00:33 2009
New Revision: 730656

URL: http://svn.apache.org/viewvc?rev=730656&view=rev
Log:
test runner is back up (thanks davisp), and tests pass in safari again (e4x syntax fix)

Modified:
    couchdb/trunk/share/server/main.js
    couchdb/trunk/share/www/script/couch_tests.js
    couchdb/trunk/test/runner.sh
    couchdb/trunk/test/test.js

Modified: couchdb/trunk/share/server/main.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/main.js?rev=730656&r1=730655&r2=730656&view=diff
==============================================================================
--- couchdb/trunk/share/server/main.js [utf-8] (original)
+++ couchdb/trunk/share/server/main.js [utf-8] Thu Jan  1 18:00:33 2009
@@ -133,7 +133,6 @@
   return publicMethods;
 })();
 
-
 // this function provides a shortcut for managing responses by Accept header
 respondWith = function(req, responders) {
   var accept = req.headers["Accept"];
@@ -153,9 +152,9 @@
       resp["headers"]["Content-Type"] = bestMime;
       return resp;
     }
-  } 
-  if (responders.default) {
-    return responders[responders.default]();
+  }
+  if (responders.fallback) {
+    return responders[responders.fallback]();
   } 
   throw({code:406, body:"Not Acceptable: "+accept});
 }

Modified: couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_tests.js?rev=730656&r1=730655&r2=730656&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/couch_tests.js [utf-8] Thu Jan  1 18:00:33 2009
@@ -2034,43 +2034,49 @@
      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 @@
                }
              };
            }
-         }).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);
      

Modified: couchdb/trunk/test/runner.sh
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/runner.sh?rev=730656&r1=730655&r2=730656&view=diff
==============================================================================
--- couchdb/trunk/test/runner.sh (original)
+++ couchdb/trunk/test/runner.sh Thu Jan  1 18:00:33 2009
@@ -4,4 +4,4 @@
 
 erl -noshell -pa ../src/couchdb -pa ../src/mochiweb -eval "runner:run()"
 
-cat ../share/www/script/couch.js ../share/www/script/couch_tests.js test.js  | ../src/couchdb/couchjs
-
+cat ../share/www/script/couch.js ../share/www/script/couch_test_runner.js ../share/www/script/couch_tests.js
test.js  | ../src/couchdb/couchjs -

Modified: couchdb/trunk/test/test.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/test.js?rev=730656&r1=730655&r2=730656&view=diff
==============================================================================
--- couchdb/trunk/test/test.js (original)
+++ couchdb/trunk/test/test.js Thu Jan  1 18:00:33 2009
@@ -67,8 +67,7 @@
           var h = headers[i];
           if (keymatcher.test(h)) {
             var value = h.substr(key.length+2);
-            value = value.slice(0, value.length-1);
-            return value;
+            return value.replace(/^\s+|\s+$/g,"");
           }
         }
         return "";



Mime
View raw message