Clumpy Bug Fix and Unit Tests

Posted at 2:30 pm on March 1st, 2009

Filed in:

I fixed a bug today that prevented a Clumpy instance from being re-used. You can download the latest version here.

Also, I just published some unit tests for Clumpy. You can help keep Clumpy stable by submitting new test cases.

5 Responses

  1. Vas Gábor said:

    Hello,

    I have an issue with Clumpy's for_in_loop(). The keys of the object to loop over are extracted synchronously. When chained after a Clumpy loop which modifies the object then it won't work as I would expect:

    var o = {};
    clumpy
      .for_loop(/*add properties to o*/)
      .for_in_loop(o, function(key) {
        // will never be called
      })

    Anyway, Clumpy is a great library, I use it quite often, thanks.

    October 31st, 2012 at 3:07 am
  2. Thanks, Vas, good catch! I'll see if I can find a good solution.

    October 31st, 2012 at 7:28 am
  3. It's fixed. Here's the latest version: http://www.tumuski.com/library/Clumpy/Clumpy-2012-10-31.js

    Also I named a test case after you:
    http://www.tumuski.com/code/clumpy/unit-tests/

    October 31st, 2012 at 8:14 am
  4. I've thought of another problem with this, but fixing that will require changing the interface of Clumpy.

    The bug fix above makes Clumpy wait until the loop is executed before it reads the *properties* of the object. But if the variable "o" is assigned a new value asynchronously, the old value is still the one used. I'll need to change it so that for_in_loop works like this:

    clumpy.for_in_loop (function () { return o; }, function(key) {
        ...
    })

    I can have it automatically detect whether the first argument is a function or not, for backward compatibility. But I'll also need to add an option for using it the old way, in case anyone out there is already passing a function as the object to iterate over.

    October 31st, 2012 at 8:37 am
  5. April 14th, 2013 at 11:01 pm

Leave a Comment

  • Formatting
    • No HTML. Any code you enter will display as that code.
    • If you are putting code in your reply in order to present the code itself, you can use these special HTML comments for formatting:
      Inline: <!--code-->...<!--/code-->
      Block: <!--pre-->...<!--/pre-->

© Thomas Peri