Bug 1470688 [wpt PR 11642] - [testharness.js][docs] Improve and document assert_object_equals, a=testonly
authorSimon Pieters <zcorpan@gmail.com>
Fri, 06 Jul 2018 22:26:40 +0000
changeset 426041 f6af821b8f761ee70bbe1fd4a11c6abd920cc6f2
parent 426040 ebd991ef5bb5d7d2510f72e68193a2134c3c5160
child 426042 6bbb82fecf4a7388a59d3289a7c53ce996f073cd
push id34267
push userrgurzau@mozilla.com
push dateWed, 11 Jul 2018 22:05:21 +0000
treeherdermozilla-central@3aca103e4915 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1470688, 11642, 10262
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/docs/_writing-tests/testharness-api.md
testing/web-platform/tests/resources/testharness.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -565085,17 +565085,17 @@
    "70c63a4ba676db565a4044d674da1beb1dd059ce",
    "support"
   ],
   "docs/_writing-tests/testdriver.md": [
    "92538a06939f447ae351409886833494f42f36ec",
    "support"
   ],
   "docs/_writing-tests/testharness-api.md": [
-   "ccad9b2b76eb48205d1f30847e0472e565d22156",
+   "a4109b95dfdd98b9f83d15dce8c47867fd0f37ff",
    "support"
   ],
   "docs/_writing-tests/testharness.md": [
    "67801e31fa6bf99a22a5407a7e59567e714ee7c3",
    "support"
   ],
   "docs/_writing-tests/visual.md": [
    "43ab66e46d0a59851c3ad9d11cc0e2d5dd3ca8c5",
--- a/testing/web-platform/tests/docs/_writing-tests/testharness-api.md
+++ b/testing/web-platform/tests/docs/_writing-tests/testharness-api.md
@@ -695,16 +695,21 @@ Relies on `===`, distinguishes between `
 asserts that `actual` is a different value to `expected`.
 This means that `expected` is a misnomer.
 Relies on `===`, distinguishes between `-0` and `+0`, and has a specific check for `NaN`.
 
 ### `assert_in_array(actual, expected, description)`
 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
 to the corresponding property value in `expected`
 
 ### `assert_array_approx_equals(actual, expected, epsilon, description)`
 asserts that `actual` and `expected` have the same
 length and each indexed property in `actual` is a number
--- a/testing/web-platform/tests/resources/testharness.js
+++ b/testing/web-platform/tests/resources/testharness.js
@@ -992,16 +992,19 @@ policies and contribution forms [3].
         assert(expected.indexOf(actual) != -1, "assert_in_array", description,
                                                "value ${actual} not in array ${expected}",
                                                {actual:actual, expected:expected});
     }
     expose(assert_in_array, "assert_in_array");
 
     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)
          {
              stack.push(actual);
 
              var p;
              for (p in actual) {
                  assert(expected.hasOwnProperty(p), "assert_object_equals", description,