Bug 1470688 [wpt PR 11642] - [testharness.js][docs] Improve and document assert_object_equals, a=testonly

Automatic update from web-platform-tests[testharness.js][docs] Improve and document assert_object_equals (#11642)

Fixes #10262.
--

wpt-commits: 5efecac39e051e64c0f4aa72f866f105e226f1a5
wpt-pr: 11642
This commit is contained in:
Simon Pieters 2018-07-06 22:26:40 +00:00 коммит произвёл James Graham
Родитель 1ce7e16c82
Коммит b93ace3ff6
3 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -565090,7 +565090,7 @@
"support"
],
"docs/_writing-tests/testharness-api.md": [
"ccad9b2b76eb48205d1f30847e0472e565d22156",
"a4109b95dfdd98b9f83d15dce8c47867fd0f37ff",
"support"
],
"docs/_writing-tests/testharness.md": [

Просмотреть файл

@ -700,6 +700,11 @@ Relies on `===`, distinguishes between `-0` and `+0`, and has a specific check f
asserts that `expected` is an Array, and `actual` is equal to one of the
members i.e. `expected.indexOf(actual) != -1`
### `assert_object_equals(actual, expected, description)`
asserts that `actual` is an object and not null and that all enumerable
properties on `actual` are own properties on `expected` with the same values,
recursing if the value is an object and not null.
### `assert_array_equals(actual, expected, description)`
asserts that `actual` and `expected` have the same
length and the value of each indexed property in `actual` is the strictly equal

Просмотреть файл

@ -997,6 +997,9 @@ policies and contribution forms [3].
function assert_object_equals(actual, expected, description)
{
assert(typeof actual === "object" && actual !== null, "assert_object_equals", description,
"value is ${actual}, expected object",
{actual: actual});
//This needs to be improved a great deal
function check_equal(actual, expected, stack)
{