MCPcopy Create free account
hub / github.com/nodejs/node / assert_object_equals

Function assert_object_equals

deps/v8/test/wasm-js/third_party/testharness.js:1195–1228  ·  view source on GitHub ↗
(actual, expected, description)

Source from the content-addressed store, hash-verified

1193 // This function was deprecated in July of 2015.
1194 // See https://github.com/web-platform-tests/wpt/issues/2033
1195 function assert_object_equals(actual, expected, description)
1196 {
1197 assert(typeof actual === "object" && actual !== null, "assert_object_equals", description,
1198 "value is ${actual}, expected object",
1199 {actual: actual});
1200 //This needs to be improved a great deal
1201 function check_equal(actual, expected, stack)
1202 {
1203 stack.push(actual);
1204
1205 var p;
1206 for (p in actual) {
1207 assert(expected.hasOwnProperty(p), "assert_object_equals", description,
1208 "unexpected property ${p}", {p:p});
1209
1210 if (typeof actual[p] === "object" && actual[p] !== null) {
1211 if (stack.indexOf(actual[p]) === -1) {
1212 check_equal(actual[p], expected[p], stack);
1213 }
1214 } else {
1215 assert(same_value(actual[p], expected[p]), "assert_object_equals", description,
1216 "property ${p} expected ${expected} got ${actual}",
1217 {p:p, expected:expected[p], actual:actual[p]});
1218 }
1219 }
1220 for (p in expected) {
1221 assert(actual.hasOwnProperty(p),
1222 "assert_object_equals", description,
1223 "expected property ${p} missing", {p:p});
1224 }
1225 stack.pop();
1226 }
1227 check_equal(actual, expected, []);
1228 }
1229 expose(assert_object_equals, "assert_object_equals");
1230
1231 function assert_array_equals(actual, expected, description)

Callers

nothing calls this directly

Calls 2

assertFunction · 0.70
check_equalFunction · 0.70

Tested by

no test coverage detected