Changeset 90430 in webkit


Ignore:
Timestamp:
Jul 5, 2011 8:15:24 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-07-05 Adam Barth <abarth@webkit.org>

Add first unit tests for garden-o-matic
https://bugs.webkit.org/show_bug.cgi?id=63969

Reviewed by Eric Seidel.

I've also reformated base.js to match WebKit style, as discussed in the
previous bug.

  • Scripts/webkitpy/tool/servers/data/gardeningserver/base.js:
  • Scripts/webkitpy/tool/servers/data/gardeningserver/base_unittests.js: Added.
  • Scripts/webkitpy/tool/servers/data/gardeningserver/run-unittests.html: Added.
Location:
trunk/Tools
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90429 r90430  
     12011-07-05  Adam Barth  <abarth@webkit.org>
     2
     3        Add first unit tests for garden-o-matic
     4        https://bugs.webkit.org/show_bug.cgi?id=63969
     5
     6        Reviewed by Eric Seidel.
     7
     8        I've also reformated base.js to match WebKit style, as discussed in the
     9        previous bug.
     10
     11        * Scripts/webkitpy/tool/servers/data/gardeningserver/base.js:
     12        * Scripts/webkitpy/tool/servers/data/gardeningserver/base_unittests.js: Added.
     13        * Scripts/webkitpy/tool/servers/data/gardeningserver/run-unittests.html: Added.
     14
    1152011-07-05  Eric Seidel  <eric@webkit.org>
    216
  • trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/base.js

    r90428 r90430  
    11var base = base || {};
    22
    3 (function() {
    4   base.joinPath = function(parent, child) {
     3(function(){
     4
     5base.joinPath = function(parent, child)
     6{
     7    if (parent.length == 0)
     8        return child;
    59    return parent + '/' + child;
    6   }
     10}
    711
    8   base.filterTree = function(tree, is_leaf, predicate) {
    9     var filtered_tree = {};
     12base.filterTree = function(tree, isLeaf, predicate)
     13{
     14    var filteredTree = {};
    1015
    11     function walkSubtree(subtree, directory) {
    12       for (var child_name in subtree) {
    13         var child = subtree[child_name];
    14         var child_path = base.joinPath(directory, child_name);
    15         if (is_leaf(child)) {
    16           if (predicate(child))
    17             filtered_tree[child_path] = child;
    18           continue;
     16    function walkSubtree(subtree, directory)
     17    {
     18        for (var childName in subtree) {
     19            var child = subtree[childName];
     20            var childPath = base.joinPath(directory, childName);
     21            if (isLeaf(child)) {
     22                if (predicate(child))
     23                    filteredTree[childPath] = child;
     24                continue;
     25            }
     26            walkSubtree(child, childPath);
    1927        }
    20         walkSubtree(child, child_path);
    21       }
    2228    }
    2329
    2430    walkSubtree(tree, '');
    25     return filtered_tree;
    26   }
     31    return filteredTree;
     32}
     33
    2734})();
Note: See TracChangeset for help on using the changeset viewer.