couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [01/37] move JS tests into safety
Date Fri, 10 Oct 2014 19:12:15 GMT
Repository: couchdb
Updated Branches:
  refs/heads/goodbye-futon [created] 4fa015a86


http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_conflicts.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_conflicts.js b/share/www/script/test/view_conflicts.js
deleted file mode 100644
index 96f97d5..0000000
--- a/share/www/script/test/view_conflicts.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_conflicts = function(debug) {
-  var dbA = new CouchDB("test_suite_db_a", {"X-Couch-Full-Commit":"false"});
-  dbA.deleteDb();
-  dbA.createDb();
-  var dbB = new CouchDB("test_suite_db_b", {"X-Couch-Full-Commit":"false"});
-  dbB.deleteDb();
-  dbB.createDb();
-  if (debug) debugger;
-
-  var docA = {_id: "foo", bar: 42};
-  T(dbA.save(docA).ok);
-  CouchDB.replicate(dbA.name, dbB.name);
-
-  var docB = dbB.open("foo");
-  docB.bar = 43;
-  dbB.save(docB);
-  docA.bar = 41;
-  dbA.save(docA);
-  CouchDB.replicate(dbA.name, dbB.name);
-
-  var doc = dbB.open("foo", {conflicts: true});
-  T(doc._conflicts.length == 1);
-  var conflictRev = doc._conflicts[0];
-  if (doc.bar == 41) { // A won
-    T(conflictRev == docB._rev);
-  } else { // B won
-    T(doc.bar == 43);
-    T(conflictRev == docA._rev);
-  }
-
-  var results = dbB.query(function(doc) {
-    if (doc._conflicts) {
-      emit(doc._id, doc._conflicts);
-    }
-  });
-  T(results.rows[0].value[0] == conflictRev);
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_errors.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
deleted file mode 100644
index e8bd08e..0000000
--- a/share/www/script/test/view_errors.js
+++ /dev/null
@@ -1,189 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_errors = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"true"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  run_on_modified_server(
-    [{section: "couchdb",
-      key: "os_process_timeout",
-      value: "500"}],
-    function() {
-      var doc = {integer: 1, string: "1", array: [1, 2, 3]};
-      T(db.save(doc).ok);
-
-      // emitting a key value that is undefined should result in that row
-      // being included in the view results as null
-      var results = db.query(function(doc) {
-        emit(doc.undef, null);
-      });
-      T(results.total_rows == 1);
-      T(results.rows[0].key == null);
-
-      // if a view function throws an exception, its results are not included in
-      // the view index, but the view does not itself raise an error
-      var results = db.query(function(doc) {
-        doc.undef(); // throws an error
-      });
-      T(results.total_rows == 0);
-
-      // if a view function includes an undefined value in the emitted key or
-      // value, it is treated as null
-      var results = db.query(function(doc) {
-        emit([doc._id, doc.undef], null);
-      });
-      T(results.total_rows == 1);
-      T(results.rows[0].key[1] == null);
-      
-      // querying a view with invalid params should give a resonable error message
-      var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view?startkey=foo", {
-        headers: {"Content-Type": "application/json"},
-        body: JSON.stringify({language: "javascript",
-          map : "function(doc){emit(doc.integer)}"
-        })
-      });
-      T(JSON.parse(xhr.responseText).error == "bad_request");
-
-      // content type must be json
-      var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view", {
-        headers: {"Content-Type": "application/x-www-form-urlencoded"},
-        body: JSON.stringify({language: "javascript",
-          map : "function(doc){}"
-        })
-      });
-      T(xhr.status == 415);
-
-      var map = function (doc) {emit(doc.integer, doc.integer);};
-
-      try {
-          db.query(map, null, {group: true});
-          T(0 == 1);
-      } catch(e) {
-          T(e.error == "query_parse_error");
-      }
-
-      var designDoc = {
-        _id:"_design/test",
-        language: "javascript",
-        views: {
-          "no_reduce": {map:"function(doc) {emit(doc._id, null);}"},
-          "with_reduce": {
-            map:"function (doc) {emit(doc.integer, doc.integer)};",
-            reduce:"function (keys, values) { return sum(values); };"}
-        }
-      };
-      T(db.save(designDoc).ok);
-
-      var designDoc2 = {
-        _id:"_design/testbig",
-        language: "javascript",
-        views: {
-          "reduce_too_big"  : {
-            map:"function (doc) {emit(doc.integer, doc.integer)};",
-            reduce:"function (keys, values) { var chars = []; for (var i=0; i < 1000;
i++) {chars.push('wazzap');};return chars; };"}
-        }
-      };
-      T(db.save(designDoc2).ok);
-
-      try {
-          db.view("test/no_reduce", {group: true});
-          T(0 == 1);
-      } catch(e) {
-          T(db.last_req.status == 400);
-          T(e.error == "query_parse_error");
-      }
-
-      try {
-          db.view("test/no_reduce", {group_level: 1});
-          T(0 == 1);
-      } catch(e) {
-          T(db.last_req.status == 400);
-          T(e.error == "query_parse_error");
-      }
-
-      try {
-        db.view("test/no_reduce", {reduce: true});
-        T(0 == 1);
-      } catch(e) {
-        T(db.last_req.status == 400);
-        T(e.error == "query_parse_error");
-      }
-
-      db.view("test/no_reduce", {reduce: false});
-      TEquals(200, db.last_req.status, "reduce=false for map views (without"
-                                     + " group or group_level) is allowed");
-
-      try {
-          db.view("test/with_reduce", {group: true, reduce: false});
-          T(0 == 1);
-      } catch(e) {
-          T(db.last_req.status == 400);
-          T(e.error == "query_parse_error");
-      }
-
-      try {
-          db.view("test/with_reduce", {group_level: 1, reduce: false});
-          T(0 == 1);
-      } catch(e) {
-        T(db.last_req.status == 400);
-          T(e.error == "query_parse_error");
-      }
-
-      var designDoc3 = {
-        _id:"_design/infinite",
-        language: "javascript",
-        views: {
-          "infinite_loop" :{map:"function(doc) {while(true){emit(doc,doc);}};"}
-        }
-      };
-      T(db.save(designDoc3).ok);
-
-      try {
-          db.view("infinite/infinite_loop");
-          T(0 == 1);
-      } catch(e) {
-          T(e.error == "os_process_error");
-      }
-
-      // Check error responses for invalid multi-get bodies.
-      var path = "/test_suite_db/_design/test/_view/no_reduce";
-      var xhr = CouchDB.request("POST", path, {body: "[]"});
-      T(xhr.status == 400);
-      result = JSON.parse(xhr.responseText);
-      T(result.error == "bad_request");
-      T(result.reason == "Request body must be a JSON object");
-      var data = "{\"keys\": 1}";
-      xhr = CouchDB.request("POST", path, {body:data});
-      T(xhr.status == 400);
-      result = JSON.parse(xhr.responseText);
-      T(result.error == "bad_request");
-      T(result.reason == "`keys` member must be a array.");
-
-      // if the reduce grows to fast, throw an overflow error
-      var path = "/test_suite_db/_design/testbig/_view/reduce_too_big";
-      xhr = CouchDB.request("GET", path);
-      T(xhr.status == 500);
-      result = JSON.parse(xhr.responseText);
-      T(result.error == "reduce_overflow_error");
-
-      try {
-          db.query(function() {emit(null, null)}, null, {startkey: 2, endkey:1});
-          T(0 == 1);
-      } catch(e) {
-          T(e.error == "query_parse_error");
-          T(e.reason.match(/no rows can match/i));
-      }
-    });
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_include_docs.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_include_docs.js b/share/www/script/test/view_include_docs.js
deleted file mode 100644
index dab79b8..0000000
--- a/share/www/script/test/view_include_docs.js
+++ /dev/null
@@ -1,192 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_include_docs = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  var docs = makeDocs(0, 100);
-  db.bulkSave(docs);
-
-  var designDoc = {
-    _id:"_design/test",
-    language: "javascript",
-    views: {
-      all_docs: {
-        map: "function(doc) { emit(doc.integer, doc.string) }"
-      },
-      with_prev: {
-        map: "function(doc){if(doc.prev) emit(doc._id,{'_rev':doc.prev}); else emit(doc._id,{'_rev':doc._rev});}"
-      },
-      with_id: {
-        map: "function(doc) {if(doc.link_id) { var value = {'_id':doc.link_id}; if (doc.link_rev)
{value._rev = doc.link_rev}; emit(doc._id, value);}};"
-      },
-      summate: {
-        map:"function (doc) { if (typeof doc.integer === 'number') {emit(doc.integer, doc.integer)};}",
-        reduce:"function (keys, values) { return sum(values); };"
-      }
-    }
-  }
-  T(db.save(designDoc).ok);
-
-  var resp = db.view('test/all_docs', {include_docs: true, limit: 2});
-  T(resp.rows.length == 2);
-  T(resp.rows[0].id == "0");
-  T(resp.rows[0].doc._id == "0");
-  T(resp.rows[1].id == "1");
-  T(resp.rows[1].doc._id == "1");
-
-  resp = db.view('test/all_docs', {include_docs: true}, [29, 74]);
-  T(resp.rows.length == 2);
-  T(resp.rows[0].doc._id == "29");
-  T(resp.rows[1].doc.integer == 74);
-
-  resp = db.allDocs({limit: 2, skip: 1, include_docs: true});
-  T(resp.rows.length == 2);
-  T(resp.rows[0].doc.integer == 1);
-  T(resp.rows[1].doc.integer == 10);
-
-  resp = db.allDocs({include_docs: true}, ['not_a_doc']);
-  T(resp.rows.length == 1);
-  T(!resp.rows[0].doc);
-
-  resp = db.allDocs({include_docs: true}, ["1", "foo"]);
-  T(resp.rows.length == 2);
-  T(resp.rows[0].doc.integer == 1);
-  T(!resp.rows[1].doc);
-
-  resp = db.allDocs({include_docs: true, limit: 0});
-  T(resp.rows.length == 0);
-
-  // No reduce support
-  try {
-      resp = db.view('test/summate', {include_docs: true});
-      alert(JSON.stringify(resp));
-      T(0==1);
-  } catch (e) {
-      T(e.error == 'query_parse_error');
-  }
-
-  // Reduce support when reduce=false
-  resp = db.view('test/summate', {reduce: false, include_docs: true});
-  T(resp.rows.length == 100);
-
-  // Not an error with include_docs=false&reduce=true
-  resp = db.view('test/summate', {reduce: true, include_docs: false});
-  T(resp.rows.length == 1);
-  T(resp.rows[0].value == 4950);
-
-  T(db.save({
-    "_id": "link-to-10",
-    "link_id" : "10"
-  }).ok);
-  
-  // you can link to another doc from a value.
-  resp = db.view("test/with_id", {key:"link-to-10"});
-  T(resp.rows[0].key == "link-to-10");
-  T(resp.rows[0].value["_id"] == "10");
-  
-  resp = db.view("test/with_id", {key:"link-to-10",include_docs: true});
-  T(resp.rows[0].key == "link-to-10");
-  T(resp.rows[0].value["_id"] == "10");
-  T(resp.rows[0].doc._id == "10");
-
-  // Check emitted _rev controls things
-  resp = db.allDocs({include_docs: true}, ["0"]);
-  var before = resp.rows[0].doc;
-
-  var after = db.open("0");
-  after.integer = 100;
-  after.prev = after._rev;
-  resp = db.save(after)
-  T(resp.ok);
-  
-  var after = db.open("0");
-  TEquals(resp.rev, after._rev, "fails with firebug running");
-  T(after._rev != after.prev, "passes");
-  TEquals(100, after.integer, "fails with firebug running");
-
-  // should emit the previous revision
-  resp = db.view("test/with_prev", {include_docs: true}, ["0"]);
-  T(resp.rows[0].doc._id == "0");
-  T(resp.rows[0].doc._rev == before._rev);
-  T(!resp.rows[0].doc.prev);
-  T(resp.rows[0].doc.integer == 0);
-
-  var xhr = CouchDB.request("POST", "/test_suite_db/_compact");
-  T(xhr.status == 202)
-  while (db.info().compact_running) {}
-
-  resp = db.view("test/with_prev", {include_docs: true}, ["0", "23"]);
-  T(resp.rows.length == 2);
-  T(resp.rows[0].key == "0");
-  T(resp.rows[0].id == "0");
-  T(!resp.rows[0].doc);
-  T(resp.rows[0].doc == null);
-  T(resp.rows[1].doc.integer == 23);
-
-  // COUCHDB-549 - include_docs=true with conflicts=true
-
-  var dbA = new CouchDB("test_suite_db_a", {"X-Couch-Full-Commit":"false"});
-  var dbB = new CouchDB("test_suite_db_b", {"X-Couch-Full-Commit":"false"});
-
-  dbA.deleteDb();
-  dbA.createDb();
-  dbB.deleteDb();
-  dbB.createDb();
-
-  var ddoc = {
-    _id: "_design/mydesign",
-    language : "javascript",
-    views : {
-      myview : {
-        map: (function(doc) {
-          emit(doc.value, 1);
-        }).toString()
-      }
-    }
-  };
-  TEquals(true, dbA.save(ddoc).ok);
-
-  var doc1a = {_id: "foo", value: 1, str: "1"};
-  TEquals(true, dbA.save(doc1a).ok);
-
-  var doc1b = {_id: "foo", value: 1, str: "666"};
-  TEquals(true, dbB.save(doc1b).ok);
-
-  var doc2 = {_id: "bar", value: 2, str: "2"};
-  TEquals(true, dbA.save(doc2).ok);
-
-  TEquals(true, CouchDB.replicate(dbA.name, dbB.name).ok);
-
-  doc1b = dbB.open("foo", {conflicts: true});
-  TEquals(true, doc1b._conflicts instanceof Array);
-  TEquals(1, doc1b._conflicts.length);
-  var conflictRev = doc1b._conflicts[0];
-
-  doc2 = dbB.open("bar", {conflicts: true});
-  TEquals("undefined", typeof doc2._conflicts);
-
-  resp = dbB.view("mydesign/myview", {include_docs: true, conflicts: true});
-
-  TEquals(2, resp.rows.length);
-  TEquals(true, resp.rows[0].doc._conflicts instanceof Array);
-  TEquals(1, resp.rows[0].doc._conflicts.length);
-  TEquals(conflictRev, resp.rows[0].doc._conflicts[0]);
-  TEquals("undefined", typeof resp.rows[1].doc._conflicts);
-
-  // cleanup
-  dbA.deleteDb();
-  dbB.deleteDb();
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_multi_key_all_docs.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_multi_key_all_docs.js b/share/www/script/test/view_multi_key_all_docs.js
deleted file mode 100644
index 7c7f6f8..0000000
--- a/share/www/script/test/view_multi_key_all_docs.js
+++ /dev/null
@@ -1,95 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_multi_key_all_docs = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  var docs = makeDocs(0, 100);
-  db.bulkSave(docs);
-
-  var keys = ["10","15","30","37","50"];
-  var rows = db.allDocs({},keys).rows;
-  T(rows.length == keys.length);
-  for(var i=0; i<rows.length; i++)
-    T(rows[i].id == keys[i]);
-
-  // keys in GET parameters
-  rows = db.allDocs({keys:keys}, null).rows;
-  T(rows.length == keys.length);
-  for(var i=0; i<rows.length; i++)
-    T(rows[i].id == keys[i]);
-
-  rows = db.allDocs({limit: 1}, keys).rows;
-  T(rows.length == 1);
-  T(rows[0].id == keys[0]);
-
-  // keys in GET parameters
-  rows = db.allDocs({limit: 1, keys: keys}, null).rows;
-  T(rows.length == 1);
-  T(rows[0].id == keys[0]);
-
-  rows = db.allDocs({skip: 2}, keys).rows;
-  T(rows.length == 3);
-  for(var i=0; i<rows.length; i++)
-      T(rows[i].id == keys[i+2]);
-
-  // keys in GET parameters
-  rows = db.allDocs({skip: 2, keys: keys}, null).rows;
-  T(rows.length == 3);
-  for(var i=0; i<rows.length; i++)
-      T(rows[i].id == keys[i+2]);
-
-  rows = db.allDocs({descending: "true"}, keys).rows;
-  T(rows.length == keys.length);
-  for(var i=0; i<rows.length; i++)
-      T(rows[i].id == keys[keys.length-i-1]);
-
-  // keys in GET parameters
-  rows = db.allDocs({descending: "true", keys: keys}, null).rows;
-  T(rows.length == keys.length);
-  for(var i=0; i<rows.length; i++)
-      T(rows[i].id == keys[keys.length-i-1]);
-
-  rows = db.allDocs({descending: "true", skip: 3, limit:1}, keys).rows;
-  T(rows.length == 1);
-  T(rows[0].id == keys[1]);
-
-  // keys in GET parameters
-  rows = db.allDocs({descending: "true", skip: 3, limit:1, keys: keys}, null).rows;
-  T(rows.length == 1);
-  T(rows[0].id == keys[1]);
-
-  // Check we get invalid rows when the key doesn't exist
-  rows = db.allDocs({}, [1, "i_dont_exist", "0"]).rows;
-  T(rows.length == 3);
-  T(rows[0].error == "not_found");
-  T(!rows[0].id);
-  T(rows[1].error == "not_found");
-  T(!rows[1].id);
-  T(rows[2].id == rows[2].key && rows[2].key == "0");
-
-  // keys in GET parameters
-  rows = db.allDocs({keys: [1, "i_dont_exist", "0"]}, null).rows;
-  T(rows.length == 3);
-  T(rows[0].error == "not_found");
-  T(!rows[0].id);
-  T(rows[1].error == "not_found");
-  T(!rows[1].id);
-  T(rows[2].id == rows[2].key && rows[2].key == "0");
-
-  // empty keys
-  rows = db.allDocs({keys: []}, null).rows;
-  T(rows.length == 0);
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_multi_key_design.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_multi_key_design.js b/share/www/script/test/view_multi_key_design.js
deleted file mode 100644
index a84d07a..0000000
--- a/share/www/script/test/view_multi_key_design.js
+++ /dev/null
@@ -1,220 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_multi_key_design = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  var docs = makeDocs(0, 100);
-  db.bulkSave(docs);
-
-  var designDoc = {
-    _id:"_design/test",
-    language: "javascript",
-    views: {
-      all_docs: {
-        map: "function(doc) { emit(doc.integer, doc.string) }"
-      },
-      multi_emit: {
-        map: "function(doc) {for(var i = 0 ; i < 3 ; i++) { emit(i, doc.integer) ; } }"
-      },
-      summate: {
-        map:"function (doc) {emit(doc.integer, doc.integer)};",
-        reduce:"function (keys, values) { return sum(values); };"
-      }
-    }
-  };
-  T(db.save(designDoc).ok);
-
-  // Test that missing keys work too
-  var keys = [101,30,15,37,50];
-  var reduce = db.view("test/summate",{group:true},keys).rows;
-  T(reduce.length == keys.length-1); // 101 is missing
-  for(var i=0; i<reduce.length; i++) {
-    T(keys.indexOf(reduce[i].key) != -1);
-    T(reduce[i].key == reduce[i].value);
-  }
-
-  // First, the goods:
-  var keys = [10,15,30,37,50];
-  var rows = db.view("test/all_docs",{},keys).rows;
-  for(var i=0; i<rows.length; i++) {
-    T(keys.indexOf(rows[i].key) != -1);
-    T(rows[i].key == rows[i].value);
-  }
-
-  // with GET keys
-  rows = db.view("test/all_docs",{keys:keys},null).rows;
-  for(var i=0;i<rows.length; i++) {
-    T(keys.indexOf(rows[i].key) != -1);
-    T(rows[i].key == rows[i].value);
-  }
-
-  // with empty keys
-  rows = db.view("test/all_docs",{keys:[]},null).rows;
-  T(rows.length == 0);
-
-  var reduce = db.view("test/summate",{group:true},keys).rows;
-  T(reduce.length == keys.length);
-  for(var i=0; i<reduce.length; i++) {
-    T(keys.indexOf(reduce[i].key) != -1);
-    T(reduce[i].key == reduce[i].value);
-  }
-
-  // with GET keys
-  reduce = db.view("test/summate",{group:true,keys:keys},null).rows;
-  T(reduce.length == keys.length);
-  for(var i=0; i<reduce.length; i++) {
-    T(keys.indexOf(reduce[i].key) != -1);
-    T(reduce[i].key == reduce[i].value);
-  }
-
-  // Test that invalid parameter combinations get rejected
-  var badargs = [{startkey:0}, {endkey:0}, {key: 0}, {group_level: 2}];
-  var getbadargs = [{startkey:0, keys:keys}, {endkey:0, keys:keys}, 
-      {key:0, keys:keys}, {group_level: 2, keys:keys}];
-  for(var i in badargs)
-  {
-      try {
-          db.view("test/all_docs",badargs[i],keys);
-          T(0==1);
-      } catch (e) {
-          T(e.error == "query_parse_error");
-      }
-
-      try {
-          db.view("test/all_docs",getbadargs[i],null);
-          T(0==1);
-      } catch (e) {
-          T(e.error = "query_parse_error");
-      }
-  }
-
-  try {
-      db.view("test/summate",{},keys);
-      T(0==1);
-  } catch (e) {
-      T(e.error == "query_parse_error");
-  }
-
-  try {
-      db.view("test/summate",{keys:keys},null);
-      T(0==1);
-  } catch (e) {
-      T(e.error == "query_parse_error");
-  }
-
-  // Test that a map & reduce containing func support keys when reduce=false
-  var resp = db.view("test/summate", {reduce: false}, keys);
-  T(resp.rows.length == 5);
-
-  resp = db.view("test/summate", {reduce: false, keys: keys}, null);
-  T(resp.rows.length == 5);
-
-  // Check that limiting by startkey_docid and endkey_docid get applied
-  // as expected.
-  var curr = db.view("test/multi_emit", {startkey_docid: 21, endkey_docid: 23}, [0, 2]).rows;
-  var exp_key = [ 0,  0,  0,  2,  2,  2] ;
-  var exp_val = [21, 22, 23, 21, 22, 23] ;
-  T(curr.length == 6);
-  for( var i = 0 ; i < 6 ; i++)
-  {
-      T(curr[i].key == exp_key[i]);
-      T(curr[i].value == exp_val[i]);
-  }
-
-  curr = db.view("test/multi_emit", {startkey_docid: 21, endkey_docid: 23, keys: [0, 2]},
null).rows;
-  T(curr.length == 6);
-  for( var i = 0 ; i < 6 ; i++)
-  {
-      T(curr[i].key == exp_key[i]);
-      T(curr[i].value == exp_val[i]);
-  }
-
-  // Check limit works
-  curr = db.view("test/all_docs", {limit: 1}, keys).rows;
-  T(curr.length == 1);
-  T(curr[0].key == 10);
-
-  curr = db.view("test/all_docs", {limit: 1, keys: keys}, null).rows;
-  T(curr.length == 1);
-  T(curr[0].key == 10);
-
-  // Check offset works
-  curr = db.view("test/multi_emit", {skip: 1}, [0]).rows;
-  T(curr.length == 99);
-  T(curr[0].value == 1);
-
-  curr = db.view("test/multi_emit", {skip: 1, keys: [0]}, null).rows;
-  T(curr.length == 99);
-  T(curr[0].value == 1);
-
-  // Check that dir works
-  curr = db.view("test/multi_emit", {descending: "true"}, [1]).rows;
-  T(curr.length == 100);
-  T(curr[0].value == 99);
-  T(curr[99].value == 0);
-
-  curr = db.view("test/multi_emit", {descending: "true", keys: [1]}, null).rows;
-  T(curr.length == 100);
-  T(curr[0].value == 99);
-  T(curr[99].value == 0);
-
-  // Check a couple combinations
-  curr = db.view("test/multi_emit", {descending: "true", skip: 3, limit: 2}, [2]).rows;
-  T(curr.length, 2);
-  T(curr[0].value == 96);
-  T(curr[1].value == 95);
-
-  curr = db.view("test/multi_emit", {descending: "true", skip: 3, limit: 2, keys: [2]}, null).rows;
-  T(curr.length, 2);
-  T(curr[0].value == 96);
-  T(curr[1].value == 95);
-
-  curr = db.view("test/multi_emit", {skip: 2, limit: 3, startkey_docid: "13"}, [0]).rows;
-  T(curr.length == 3);
-  T(curr[0].value == 15);
-  T(curr[1].value == 16);
-  T(curr[2].value == 17);
-
-  curr = db.view("test/multi_emit", {skip: 2, limit: 3, startkey_docid: "13", keys: [0]},
null).rows;
-  T(curr.length == 3);
-  T(curr[0].value == 15);
-  T(curr[1].value == 16);
-  T(curr[2].value == 17);
-
-  curr = db.view("test/multi_emit",
-          {skip: 1, limit: 5, startkey_docid: "25", endkey_docid: "27"}, [1]).rows;
-  T(curr.length == 2);
-  T(curr[0].value == 26);
-  T(curr[1].value == 27);
-
-  curr = db.view("test/multi_emit",
-          {skip: 1, limit: 5, startkey_docid: "25", endkey_docid: "27", keys: [1]}, null).rows;
-  T(curr.length == 2);
-  T(curr[0].value == 26);
-  T(curr[1].value == 27);
-
-  curr = db.view("test/multi_emit",
-          {skip: 1, limit: 5, startkey_docid: "28", endkey_docid: "26", descending: "true"},
[1]).rows;
-  T(curr.length == 2);
-  T(curr[0].value == 27);
-  T(curr[1].value == 26);
-
-  curr = db.view("test/multi_emit",
-          {skip: 1, limit: 5, startkey_docid: "28", endkey_docid: "26", descending: "true",
keys: [1]}, null).rows;
-  T(curr.length == 2);
-  T(curr[0].value == 27);
-  T(curr[1].value == 26);
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_multi_key_temp.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_multi_key_temp.js b/share/www/script/test/view_multi_key_temp.js
deleted file mode 100644
index 3c05409..0000000
--- a/share/www/script/test/view_multi_key_temp.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_multi_key_temp = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  var docs = makeDocs(0, 100);
-  db.bulkSave(docs);
-
-  var queryFun = function(doc) { emit(doc.integer, doc.integer) };
-  var reduceFun = function (keys, values) { return sum(values); };
-
-  var keys = [10,15,30,37,50];
-  var rows = db.query(queryFun, null, {}, keys).rows;
-  for(var i=0; i<rows.length; i++) {
-    T(keys.indexOf(rows[i].key) != -1);
-    T(rows[i].key == rows[i].value);
-  }
-
-  var reduce = db.query(queryFun, reduceFun, {group:true}, keys).rows;
-  for(var i=0; i<reduce.length; i++) {
-    T(keys.indexOf(reduce[i].key) != -1);
-    T(reduce[i].key == reduce[i].value);
-  }
-
-  rows = db.query(queryFun, null, {}, []).rows;
-  T(rows.length == 0);
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_offsets.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_offsets.js b/share/www/script/test/view_offsets.js
deleted file mode 100644
index 464a1ae..0000000
--- a/share/www/script/test/view_offsets.js
+++ /dev/null
@@ -1,108 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_offsets = function(debug) {
-  if (debug) debugger;
-
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-
-  var designDoc = {
-    _id : "_design/test",
-    views : {
-      offset : {
-        map : "function(doc) { emit([doc.letter, doc.number], doc); }",
-      }
-    }
-  };
-  T(db.save(designDoc).ok);
-
-  var docs = [
-    {_id : "a1", letter : "a", number : 1, foo: "bar"},
-    {_id : "a2", letter : "a", number : 2, foo: "bar"},
-    {_id : "a3", letter : "a", number : 3, foo: "bar"},
-    {_id : "b1", letter : "b", number : 1, foo: "bar"},
-    {_id : "b2", letter : "b", number : 2, foo: "bar"},
-    {_id : "b3", letter : "b", number : 3, foo: "bar"},
-    {_id : "b4", letter : "b", number : 4, foo: "bar"},
-    {_id : "b5", letter : "b", number : 5, foo: "bar"},
-    {_id : "c1", letter : "c", number : 1, foo: "bar"},
-    {_id : "c2", letter : "c", number : 2, foo: "bar"},
-  ];
-  db.bulkSave(docs);
-
-  var check = function(startkey, offset) {
-    var opts = {startkey: startkey, descending: true};
-    T(db.view("test/offset", opts).offset == offset);
-  };
-
-  [
-      [["c", 2], 0],
-      [["c", 1], 1],
-      [["b", 5], 2],
-      [["b", 4], 3],
-      [["b", 3], 4],
-      [["b", 2], 5],
-      [["b", 1], 6],
-      [["a", 3], 7],
-      [["a", 2], 8],
-      [["a", 1], 9]
-  ].forEach(function(row){ check(row[0], row[1]);});
-
-  var runTest = function () {
-    var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-    db.deleteDb();
-    db.createDb();
-
-    var designDoc = {
-      _id : "_design/test",
-      views : {
-        offset : {
-          map : "function(doc) { emit([doc.letter, doc.number], doc);}",
-        }
-      }
-    };
-    T(db.save(designDoc).ok);
-
-    var docs = [
-      {_id : "a1", letter : "a", number : 1, foo : "bar"},
-      {_id : "a2", letter : "a", number : 2, foo : "bar"},
-      {_id : "a3", letter : "a", number : 3, foo : "bar"},
-      {_id : "b1", letter : "b", number : 1, foo : "bar"},
-      {_id : "b2", letter : "b", number : 2, foo : "bar"},
-      {_id : "b3", letter : "b", number : 3, foo : "bar"},
-      {_id : "b4", letter : "b", number : 4, foo : "bar"},
-      {_id : "b5", letter : "b", number : 5, foo : "bar"},
-      {_id : "c1", letter : "c", number : 1, foo : "bar"},
-      {_id : "c2", letter : "c", number : 2, foo : "bar"}
-    ];
-    db.bulkSave(docs);
-
-    var res1 = db.view("test/offset", {
-      startkey: ["b",4], startkey_docid: "b4", endkey: ["b"],
-      limit: 2, descending: true, skip: 1
-    })
-
-    var res2 = db.view("test/offset", {startkey: ["c", 3]});
-    var res3 = db.view("test/offset", {
-        startkey: ["b", 6],
-        endkey: ["b", 7]
-    });
-
-    return res1.offset == 4 && res2.offset == docs.length && res3.offset
== 8;
-
-  };
-
-  for(var i = 0; i < 15; i++) T(runTest());
-}
-

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_pagination.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_pagination.js b/share/www/script/test/view_pagination.js
deleted file mode 100644
index ed3a7ee..0000000
--- a/share/www/script/test/view_pagination.js
+++ /dev/null
@@ -1,147 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_pagination = function(debug) {
-    var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-    db.deleteDb();
-    db.createDb();
-    if (debug) debugger;
-
-    var docs = makeDocs(0, 100);
-    db.bulkSave(docs);
-
-    var queryFun = function(doc) { emit(doc.integer, null); };
-    var i;
-
-    // page through the view ascending
-    for (i = 0; i < docs.length; i += 10) {
-      var queryResults = db.query(queryFun, null, {
-        startkey: i,
-        startkey_docid: i,
-        limit: 10
-      });
-      T(queryResults.rows.length == 10);
-      T(queryResults.total_rows == docs.length);
-      T(queryResults.offset == i);
-      var j;
-      for (j = 0; j < 10;j++) {
-        T(queryResults.rows[j].key == i + j);
-      }
-
-      // test aliases start_key and start_key_doc_id
-      queryResults = db.query(queryFun, null, {
-        start_key: i,
-        start_key_doc_id: i,
-        limit: 10
-      });
-      T(queryResults.rows.length == 10);
-      T(queryResults.total_rows == docs.length);
-      T(queryResults.offset == i);
-      for (j = 0; j < 10;j++) {
-        T(queryResults.rows[j].key == i + j);
-      }
-    }
-
-    // page through the view descending
-    for (i = docs.length - 1; i >= 0; i -= 10) {
-      var queryResults = db.query(queryFun, null, {
-        startkey: i,
-        startkey_docid: i,
-        descending: true,
-        limit: 10
-      });
-      T(queryResults.rows.length == 10);
-      T(queryResults.total_rows == docs.length);
-      T(queryResults.offset == docs.length - i - 1);
-      var j;
-      for (j = 0; j < 10; j++) {
-        T(queryResults.rows[j].key == i - j);
-      }
-    }
-
-    // ignore decending=false. CouchDB should just ignore that.
-    for (i = 0; i < docs.length; i += 10) {
-      var queryResults = db.query(queryFun, null, {
-        startkey: i,
-        startkey_docid: i,
-        descending: false,
-        limit: 10
-      });
-      T(queryResults.rows.length == 10);
-      T(queryResults.total_rows == docs.length);
-      T(queryResults.offset == i);
-      var j;
-      for (j = 0; j < 10;j++) {
-        T(queryResults.rows[j].key == i + j);
-      }
-    }
-
-    function testEndkeyDocId(queryResults) {
-      T(queryResults.rows.length == 35);
-      T(queryResults.total_rows == docs.length);
-      T(queryResults.offset == 1);
-      T(queryResults.rows[0].id == "1");
-      T(queryResults.rows[1].id == "10");
-      T(queryResults.rows[2].id == "11");
-      T(queryResults.rows[3].id == "12");
-      T(queryResults.rows[4].id == "13");
-      T(queryResults.rows[5].id == "14");
-      T(queryResults.rows[6].id == "15");
-      T(queryResults.rows[7].id == "16");
-      T(queryResults.rows[8].id == "17");
-      T(queryResults.rows[9].id == "18");
-      T(queryResults.rows[10].id == "19");
-      T(queryResults.rows[11].id == "2");
-      T(queryResults.rows[12].id == "20");
-      T(queryResults.rows[13].id == "21");
-      T(queryResults.rows[14].id == "22");
-      T(queryResults.rows[15].id == "23");
-      T(queryResults.rows[16].id == "24");
-      T(queryResults.rows[17].id == "25");
-      T(queryResults.rows[18].id == "26");
-      T(queryResults.rows[19].id == "27");
-      T(queryResults.rows[20].id == "28");
-      T(queryResults.rows[21].id == "29");
-      T(queryResults.rows[22].id == "3");
-      T(queryResults.rows[23].id == "30");
-      T(queryResults.rows[24].id == "31");
-      T(queryResults.rows[25].id == "32");
-      T(queryResults.rows[26].id == "33");
-      T(queryResults.rows[27].id == "34");
-      T(queryResults.rows[28].id == "35");
-      T(queryResults.rows[29].id == "36");
-      T(queryResults.rows[30].id == "37");
-      T(queryResults.rows[31].id == "38");
-      T(queryResults.rows[32].id == "39");
-      T(queryResults.rows[33].id == "4");
-      T(queryResults.rows[34].id == "40");
-    }
-
-    // test endkey_docid
-    var queryResults = db.query(function(doc) { emit(null, null); }, null, {
-      startkey: null,
-      startkey_docid: 1,
-      endkey: null,
-      endkey_docid: 40
-    });
-    testEndkeyDocId(queryResults);
-
-    // test aliases end_key_doc_id and end_key
-    queryResults = db.query(function(doc) { emit(null, null); }, null, {
-      start_key: null,
-      start_key_doc_id: 1,
-      end_key: null,
-      end_key_doc_id: 40
-    });
-    testEndkeyDocId(queryResults);
-
-  };

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_sandboxing.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_sandboxing.js b/share/www/script/test/view_sandboxing.js
deleted file mode 100644
index 5c73c5a..0000000
--- a/share/www/script/test/view_sandboxing.js
+++ /dev/null
@@ -1,140 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_sandboxing = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  var doc = {integer: 1, string: "1", array: [1, 2, 3]};
-  T(db.save(doc).ok);
-/*
-  // make sure that attempting to change the document throws an error
-  var results = db.query(function(doc) {
-    doc.integer = 2;
-    emit(null, doc);
-  });
-  T(results.total_rows == 0);
-
-  var results = db.query(function(doc) {
-    doc.array[0] = 0;
-    emit(null, doc);
-  });
-  T(results.total_rows == 0);
-*/
-  // make sure that a view cannot invoke interpreter internals such as the
-  // garbage collector
-  var results = db.query(function(doc) {
-    gc();
-    emit(null, doc);
-  });
-  T(results.total_rows == 0);
-
-  // make sure that a view cannot access the map_funs array defined used by
-  // the view server
-  var results = db.query(function(doc) { map_funs.push(1); emit(null, doc); });
-  T(results.total_rows == 0);
-
-  // make sure that a view cannot access the map_results array defined used by
-  // the view server
-  var results = db.query(function(doc) { map_results.push(1); emit(null, doc); });
-  T(results.total_rows == 0);
-
-  // test for COUCHDB-925
-  // altering 'doc' variable in map function affects other map functions
-  var ddoc = {
-    _id: "_design/foobar",
-    language: "javascript",
-    views: {
-      view1: {
-        map:
-          (function(doc) {
-            if (doc.values) {
-              doc.values = [666];
-            }
-            if (doc.tags) {
-              doc.tags.push("qwerty");
-            }
-            if (doc.tokens) {
-              doc.tokens["c"] = 3;
-            }
-          }).toString()
-      },
-      view2: {
-        map:
-          (function(doc) {
-            if (doc.values) {
-              emit(doc._id, doc.values);
-            }
-            if (doc.tags) {
-              emit(doc._id, doc.tags);
-            }
-            if (doc.tokens) {
-              emit(doc._id, doc.tokens);
-            }
-          }).toString()
-      }
-    }
-  };
-  var doc1 = {
-    _id: "doc1",
-    values: [1, 2, 3]
-  };
-  var doc2 = {
-    _id: "doc2",
-    tags: ["foo", "bar"],
-    tokens: {a: 1, b: 2}
-  };
-
-  db.deleteDb();
-  db.createDb();
-  T(db.save(ddoc).ok);
-  T(db.save(doc1).ok);
-  T(db.save(doc2).ok);
-
-  var view1Results = db.view(
-    "foobar/view1", {bypass_cache: Math.round(Math.random() * 1000)});
-  var view2Results = db.view(
-    "foobar/view2", {bypass_cache: Math.round(Math.random() * 1000)});
-
-  TEquals(0, view1Results.rows.length, "view1 has 0 rows");
-  TEquals(3, view2Results.rows.length, "view2 has 3 rows");
-
-  TEquals(doc1._id, view2Results.rows[0].key);
-  TEquals(doc2._id, view2Results.rows[1].key);
-  TEquals(doc2._id, view2Results.rows[2].key);
-
-  // https://bugzilla.mozilla.org/show_bug.cgi?id=449657
-  TEquals(3, view2Results.rows[0].value.length,
-    "Warning: installed SpiderMonkey version doesn't allow sealing of arrays");
-  if (view2Results.rows[0].value.length === 3) {
-    TEquals(1, view2Results.rows[0].value[0]);
-    TEquals(2, view2Results.rows[0].value[1]);
-    TEquals(3, view2Results.rows[0].value[2]);
-  }
-
-  TEquals(1, view2Results.rows[1].value["a"]);
-  TEquals(2, view2Results.rows[1].value["b"]);
-  TEquals('undefined', typeof view2Results.rows[1].value["c"],
-    "doc2.tokens object was not sealed");
-
-  TEquals(2, view2Results.rows[2].value.length,
-    "Warning: installed SpiderMonkey version doesn't allow sealing of arrays");
-  if (view2Results.rows[2].value.length === 2) {
-    TEquals("foo", view2Results.rows[2].value[0]);
-    TEquals("bar", view2Results.rows[2].value[1]);
-  }
-
-  // cleanup
-  db.deleteDb();
-};

http://git-wip-us.apache.org/repos/asf/couchdb/blob/3ba4fc0b/share/www/script/test/view_update_seq.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/view_update_seq.js b/share/www/script/test/view_update_seq.js
deleted file mode 100644
index df92b11..0000000
--- a/share/www/script/test/view_update_seq.js
+++ /dev/null
@@ -1,106 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-couchTests.view_update_seq = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"true"});
-  db.deleteDb();
-  db.createDb();
-  if (debug) debugger;
-
-  T(db.info().update_seq == 0);
-
-  var resp = db.allDocs({update_seq:true});
-
-  T(resp.rows.length == 0);
-  T(resp.update_seq == 0);
-
-  var designDoc = {
-    _id:"_design/test",
-    language: "javascript",
-    views: {
-      all_docs: {
-        map: "function(doc) { emit(doc.integer, doc.string) }"
-      },
-      summate: {
-        map:"function (doc) { if (typeof doc.integer === 'number') { emit(doc.integer, doc.integer)};
}",
-        reduce:"function (keys, values) { return sum(values); };"
-      }
-    }
-  };
-  T(db.save(designDoc).ok);
-
-  T(db.info().update_seq == 1);
-
-  resp = db.allDocs({update_seq:true});
-
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 1);
-
-  var docs = makeDocs(0, 100);
-  db.bulkSave(docs);
-
-  resp = db.allDocs({limit: 1});
-  T(resp.rows.length == 1);
-  T(!resp.update_seq, "all docs");
-
-  resp = db.allDocs({limit: 1, update_seq:true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 101);
-
-  resp = db.view('test/all_docs', {limit: 1, update_seq:true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 101);
-
-  resp = db.view('test/all_docs', {limit: 1, update_seq:false});
-  T(resp.rows.length == 1);
-  T(!resp.update_seq, "view");
-
-  resp = db.view('test/summate', {update_seq:true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 101);
-
-  db.save({"id":"0", "integer": 1});
-  resp = db.view('test/all_docs', {limit: 1,stale: "ok", update_seq:true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 101);
-
-  db.save({"id":"00", "integer": 2});
-  resp = db.view('test/all_docs',
-    {limit: 1, stale: "update_after", update_seq: true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 101);
-
-  // wait 5 seconds for the next assertions to pass in very slow machines
-  var t0 = new Date(), t1;
-  do {
-    CouchDB.request("GET", "/");
-    t1 = new Date();
-  } while ((t1 - t0) < 5000);
-
-  resp = db.view('test/all_docs', {limit: 1, stale: "ok", update_seq: true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 103);
-
-  resp = db.view('test/all_docs', {limit: 1, update_seq:true});
-  T(resp.rows.length == 1);
-  T(resp.update_seq == 103);
-
-  resp = db.view('test/all_docs',{update_seq:true},["0","1"]);
-  T(resp.update_seq == 103);
-
-  resp = db.view('test/all_docs',{update_seq:true},["0","1"]);
-  T(resp.update_seq == 103);
-
-  resp = db.view('test/summate',{group:true, update_seq:true},[0,1]);
-  TEquals(103, resp.update_seq);
-
-};


Mime
View raw message