couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcello Nuccio (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1397) Function expressions, evals in SpiderMonkey
Date Sun, 05 Feb 2012 16:21:54 GMT


Marcello Nuccio commented on COUCHDB-1397:

this isn't as off-topic as it seems at first, because software design is heavily influenced
by ease of testability.

I've not proposed to inject every single function. I've proposed to inject the context. For
a list function it may be:

    function aList(head, req, ctx) {
      var row;
      function renderRow(row) { //... }
      while((row = ctx.getRow())) {

This greatly simplifies unit testing. And it does not imply that you mock "every internal
query server global function". You can even do without mocking, but the point is that you
are in control of it, so you can properly test whatever needs testing.

Testing with the real query server, is done in end-to-end or integration testing. This is
needed, but it does not eliminate the need for unit testing.
> Function expressions, evals in SpiderMonkey
> -------------------------------------------
>                 Key: COUCHDB-1397
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.2.1
>         Environment: All
>            Reporter: Jason Smith
> New SpiderMonkey releases do not eval() a sole anonymous function expression. That is
not a valid JavaScript statement, and so it is not a valid JavaScript script.
> COUCHDB-1302 addressed this for 1.1 and the 1.1.x branch. This ticket is for 1.2. (Sorry
to spam COUCHDB-1302. I saw "Unassigned" and read "Unresolved.")

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message