[Webkit-unassigned] [Bug 152913] Refactor compareIterations to remove duplicate code.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 14 11:34:35 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=152913

--- Comment #4 from Jason Marcell <jmarcell at apple.com> ---
Comment on attachment 268981
  --> https://bugs.webkit.org/attachment.cgi?id=268981
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268981&action=review

> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:69
> +    ok(queue.compareIterations(iteration2, iteration2) === 0, "equal"); // if statement actually falls through

Additional explanation:

My intention for the three groups of "compareIterations" tests was to give full code coverage by forcing the execution path through the three different return statements.

    compareIterations: function(a, b)
    {
        result = this.compareIterationsByRevisions(a, b);
        if (result)
1.          return result;

        // A loaded iteration may not have revision numbers if it failed early, before svn steps finished.
        result = b.loaded - a.loaded;
        if (result)
2.          return result;

3.      return b.id - a.id;
    },

For this particular test we call this.compareIterationsByRevisions and it returns 0, which is falsy, and so we don't actually return via the first return statement -- it falls through.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160114/6f5e5789/attachment.html>


More information about the webkit-unassigned mailing list