(a, b)
| 228 | } |
| 229 | |
| 230 | function objEquiv (a, b) { |
| 231 | if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) |
| 232 | return false; |
| 233 | |
| 234 | // an identical "prototype" property. |
| 235 | if (a.prototype !== b.prototype) return false; |
| 236 | //~~~I've managed to break Object.keys through screwy arguments passing. |
| 237 | // Converting to array solves the problem. |
| 238 | if (isArguments(a)) { |
| 239 | if (!isArguments(b)) { |
| 240 | return false; |
| 241 | } |
| 242 | a = pSlice.call(a); |
| 243 | b = pSlice.call(b); |
| 244 | return _deepEqual(a, b); |
| 245 | } |
| 246 | try{ |
| 247 | var ka = _keys(a), |
| 248 | kb = _keys(b), |
| 249 | key, i; |
| 250 | } catch (e) {//happens when one is a string literal and the other isn't |
| 251 | return false; |
| 252 | } |
| 253 | // having the same number of owned properties (keys incorporates hasOwnProperty) |
| 254 | if (ka.length != kb.length) |
| 255 | return false; |
| 256 | //the same set of keys (although not necessarily the same order), |
| 257 | ka.sort(); |
| 258 | kb.sort(); |
| 259 | //~~~cheap key test |
| 260 | for (i = ka.length - 1; i >= 0; i--) { |
| 261 | if (ka[i] != kb[i]) |
| 262 | return false; |
| 263 | } |
| 264 | //equivalent values for every corresponding key, and |
| 265 | //~~~possibly expensive deep test |
| 266 | for (i = ka.length - 1; i >= 0; i--) { |
| 267 | key = ka[i]; |
| 268 | if (!_deepEqual(a[key], b[key] )) |
| 269 | return false; |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | // 8. The non-equivalence assertion tests for any deep inequality. |
| 275 | // assert.notDeepEqual(actual, expected, message_opt); |
no test coverage detected
searching dependent graphs…