Changeset 90430 in webkit
- Timestamp:
- Jul 5, 2011, 8:15:24 PM (15 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90429 r90430 1 2011-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 1 15 2011-07-05 Eric Seidel <eric@webkit.org> 2 16 -
trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/base.js
r90428 r90430 1 1 var base = base || {}; 2 2 3 (function() { 4 base.joinPath = function(parent, child) { 3 (function(){ 4 5 base.joinPath = function(parent, child) 6 { 7 if (parent.length == 0) 8 return child; 5 9 return parent + '/' + child; 6 }10 } 7 11 8 base.filterTree = function(tree, is_leaf, predicate) { 9 var filtered_tree = {}; 12 base.filterTree = function(tree, isLeaf, predicate) 13 { 14 var filteredTree = {}; 10 15 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); 19 27 } 20 walkSubtree(child, child_path);21 }22 28 } 23 29 24 30 walkSubtree(tree, ''); 25 return filtered_tree; 26 } 31 return filteredTree; 32 } 33 27 34 })();
Note:
See TracChangeset
for help on using the changeset viewer.