summaryrefslogtreecommitdiff
path: root/share/www/script/test/view_errors.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-01-26 00:11:59 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-01-26 00:11:59 +0000
commit8d3b7ab31c1289e1425d1f4f348b7ca0021ab7fe (patch)
tree5e77f5c042ad40bf02eb5536fa70fb4e54b662c7 /share/www/script/test/view_errors.js
parent5a87b852a72cc36d4d7b64271ed542ce2a1befe0 (diff)
Replace the old JavaScript query server JSON library with json2.js
This change makes us interoperate better with other JSON implementations. It also means we can use the native JSON handlers in JavaScript runtimes that support them. Should be faster right away on new Spidermonkeys. There are some potential breaking changes for apps that depend on Couch blowing up on 'undefined'. json2.js serialized undefined as 'null' instead of crashing. This change will also affect people using E4X, as you can't just return an XML object and have it serialized to a string for you. Calling .toXMLString() on these is all you need to do. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@903023 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/view_errors.js')
-rw-r--r--share/www/script/test/view_errors.js17
1 files changed, 8 insertions, 9 deletions
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"},