gecko/browser/components/search/test/head.js
Matthew Noorenberghe 9dbb7af064 Bug 587780 - Part 5 - Test Google search params with @purpose. r=gavin
--HG--
extra : rebase_source : 9cdf65c3570474f543a2e9cdaf9554a62e627559
2012-05-03 23:42:29 -07:00

20 lines
696 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Recursively compare two objects and check that every property of expectedObj has the same value
* on actualObj.
*/
function isSubObjectOf(expectedObj, actualObj, name) {
for (let prop in expectedObj) {
if (typeof expectedObj[prop] == 'function')
continue;
if (expectedObj[prop] instanceof Object) {
is(actualObj[prop].length, expectedObj[prop].length, name + "[" + prop + "]");
isSubObjectOf(expectedObj[prop], actualObj[prop], name + "[" + prop + "]");
} else {
is(actualObj[prop], expectedObj[prop], name + "[" + prop + "]");
}
}
}