Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Commit

Permalink
Remove assert_object_equals.
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowbarker committed Aug 17, 2015
1 parent 42d79d0 commit 0214d0b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
6 changes: 0 additions & 6 deletions examples/apisample.htm
Expand Up @@ -68,12 +68,6 @@ <h1>Sample HTML5 API Tests</h1>
}
test(basicAssertArrayEquals, "basic assert_array_equals test");

function basicAssertObjectEquals()
{
assert_object_equals([1, 2, [1, 2]], { 0: 1, 1: 2, 2: { 0: 1, 1: 2} }, "array is equal to object")
}
test(basicAssertObjectEquals, "basic assert_object_equals test");

function basicAssertApproxEquals()
{
assert_approx_equals(10, 11, 1, "10 is approximately (+/- 1) 11")
Expand Down
33 changes: 0 additions & 33 deletions testharness.js
Expand Up @@ -891,39 +891,6 @@ policies and contribution forms [3].
}
expose(assert_in_array, "assert_in_array");

function assert_object_equals(actual, expected, description)
{
//This needs to be improved a great deal
function check_equal(actual, expected, stack)
{
stack.push(actual);

var p;
for (p in actual) {
assert(expected.hasOwnProperty(p), "assert_object_equals", description,
"unexpected property ${p}", {p:p});

if (typeof actual[p] === "object" && actual[p] !== null) {
if (stack.indexOf(actual[p]) === -1) {
check_equal(actual[p], expected[p], stack);
}
} else {
assert(same_value(actual[p], expected[p]), "assert_object_equals", description,
"property ${p} expected ${expected} got ${actual}",
{p:p, expected:expected, actual:actual});
}
}
for (p in expected) {
assert(actual.hasOwnProperty(p),
"assert_object_equals", description,
"expected property ${p} missing", {p:p});
}
stack.pop();
}
check_equal(actual, expected, []);
}
expose(assert_object_equals, "assert_object_equals");

function assert_array_equals(actual, expected, description)
{
assert(actual.length === expected.length,
Expand Down

0 comments on commit 0214d0b

Please sign in to comment.