summaryrefslogtreecommitdiff
path: root/share/www/script/test/reduce_builtin.js
diff options
context:
space:
mode:
authorNoah Slater <nslater@apache.org>2010-08-09 18:08:52 +0000
committerNoah Slater <nslater@apache.org>2010-08-09 18:08:52 +0000
commit44f0bcbdb650fcfb5c8c2e0c24c00603f42824f4 (patch)
tree4e1d28a90e48b4cea891164f6100d3eae9c90099 /share/www/script/test/reduce_builtin.js
parent38b059fefa9a659a35ac8ad5db47134dcd8506b6 (diff)
parentbfa939c1ee995cb4c69766af1b57031c564ebd2a (diff)
tagging 1.0.1
git-svn-id: https://svn.apache.org/repos/asf/couchdb/tags/1.0.1@983758 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/reduce_builtin.js')
-rw-r--r--share/www/script/test/reduce_builtin.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/share/www/script/test/reduce_builtin.js b/share/www/script/test/reduce_builtin.js
index 0db6bc09..d9635688 100644
--- a/share/www/script/test/reduce_builtin.js
+++ b/share/www/script/test/reduce_builtin.js
@@ -72,6 +72,26 @@ couchTests.reduce_builtin = function(debug) {
T(result.rows[0].value == 2*(summate(numDocs-i) - summate(i-1)));
}
+ // test for trailing characters after builtin functions, desired behaviour
+ // is to disregard any trailing characters
+ // I think the behavior should be a prefix test, so that even "_statsorama"
+ // or "_stats\nare\awesome" should work just as "_stats" does. - JChris
+
+ var trailing = ["\u000a", "orama", "\nare\nawesome", " ", " \n "];
+
+ for(var i=0; i < trailing.length; i++) {
+ result = db.query(map, "_sum" + trailing[i]);
+ T(result.rows[0].value == 2*summate(numDocs));
+ result = db.query(map, "_count" + trailing[i]);
+ T(result.rows[0].value == 1000);
+ result = db.query(map, "_stats" + trailing[i]);
+ T(result.rows[0].value.sum == 2*summate(numDocs));
+ T(result.rows[0].value.count == 1000);
+ T(result.rows[0].value.min == 1);
+ T(result.rows[0].value.max == 500);
+ T(result.rows[0].value.sumsqr == 2*sumsqr(numDocs));
+ }
+
db.deleteDb();
db.createDb();