B2G/gecko/content/base/test/unit/test_csputils.js
// helper to assert that an object or array must have a given key
helper to assert that an object or array must have a given key
helper to assert that an object or array must have a given key
function do_check_has_key(foo, key, stack) {
  if (!stack)
    stack = Components.stack.caller;
  var keys = [];
  for (let k in foo) { keys.push(k); }
  var text = key + " in [" + keys.join(",") + "]";
  for (var x in foo) {
    if (x == key) {
      ++_passedChecks;
      dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
           stack.lineNumber + "] " + text + "\n");
      return;
    }
  }
  do_throw(text, stack);
}
function do_check_has_key ( foo , key , stack ) { if ( ! stack ) stack = Components . stack . caller ; var keys = [ ] ; for ( let k in foo ) { keys . push ( k ) ; } var text = key + " in [" + keys . join ( "," ) + "]" ; for ( var x in foo ) { if ( x == key ) { ++ _passedChecks ; dump ( "TEST-PASS | " + stack . filename + " | [" + stack . name + " : " + stack . lineNumber + "] " + text + "\n" ) ; return ; } } do_throw ( text , stack ) ; }
helper to assert that an object or array must have a given key
helper to assert that an object or array must have a given key
//succeed