summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/json2.js19
-rw-r--r--share/www/script/test/show_documents.js5
-rw-r--r--share/www/script/test/update_documents.js2
-rw-r--r--share/www/script/test/view_errors.js17
4 files changed, 22 insertions, 21 deletions
diff --git a/share/www/script/json2.js b/share/www/script/json2.js
index 48c55361..39d8f370 100644
--- a/share/www/script/json2.js
+++ b/share/www/script/json2.js
@@ -1,6 +1,6 @@
/*
http://www.JSON.org/json2.js
- 2009-08-17
+ 2009-09-29
Public Domain.
@@ -8,6 +8,14 @@
See http://www.JSON.org/js.html
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+
+
This file creates a global JSON object containing two methods: stringify
and parse.
@@ -136,15 +144,9 @@
This is a reference implementation. You are free to copy, modify, or
redistribute.
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
*/
-/*jslint evil: true */
+/*jslint evil: true, strict: false */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
@@ -153,7 +155,6 @@
test, toJSON, toString, valueOf
*/
-"use strict";
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js
index f484e029..accb8522 100644
--- a/share/www/script/test/show_documents.js
+++ b/share/www/script/test/show_documents.js
@@ -61,7 +61,7 @@ couchTests.show_documents = function(debug) {
"headers" : {
"Content-Type" : "application/xml"
},
- "body" : new XML('<xml><node foo="bar"/></xml>')
+ "body" : new XML('<xml><node foo="bar"/></xml>').toXMLString()
}
}),
"no-set-etag" : stringFun(function(doc, req) {
@@ -114,7 +114,8 @@ couchTests.show_documents = function(debug) {
// E4X outside of a string. Outside of tests you
// can just use E4X literals.
eval('xml.node.@foo = doc.word');
- return xml;
+ log('xml: '+xml.toSource());
+ return xml.toXMLString();
});
provides("foo", function() {
diff --git a/share/www/script/test/update_documents.js b/share/www/script/test/update_documents.js
index 87fc7352..c7bd05b1 100644
--- a/share/www/script/test/update_documents.js
+++ b/share/www/script/test/update_documents.js
@@ -68,7 +68,7 @@ couchTests.update_documents = function(debug) {
"headers" : {
"Content-Type" : "application/xml"
},
- "body" : xml
+ "body" : xml.toXMLString()
};
return [doc, resp];
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
index 0f90c46f..c6607ad4 100644
--- a/share/www/script/test/view_errors.js
+++ b/share/www/script/test/view_errors.js
@@ -16,8 +16,6 @@ couchTests.view_errors = function(debug) {
db.createDb();
if (debug) debugger;
-
-
run_on_modified_server(
[{section: "couchdb",
key: "os_process_timeout",
@@ -26,12 +24,13 @@ couchTests.view_errors = function(debug) {
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 not
- // being included in the view results
+ // 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 == 0);
+ 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
@@ -41,13 +40,13 @@ couchTests.view_errors = function(debug) {
T(results.total_rows == 0);
// if a view function includes an undefined value in the emitted key or
- // value, an error is logged and the result is not included in the view
- // index, and the view itself does not raise an error
+ // value, it is treated as null
var results = db.query(function(doc) {
emit([doc._id, doc.undef], null);
});
- T(results.total_rows == 0);
-
+ 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"},