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

Remove assert_object_equals. #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions examples/apisample.htm
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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