{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/testharness.js/issues/144","labels_url":"https://api.github.com/repos/w3c/testharness.js/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/w3c/testharness.js/issues/144/comments","events_url":"https://api.github.com/repos/w3c/testharness.js/issues/144/events","html_url":"https://github.com/w3c/testharness.js/pull/144","id":103561873,"number":144,"title":"Make assert_object_equals more accurate and give better error messages","user":{"login":"johnmellor","id":563043,"avatar_url":"https://avatars.githubusercontent.com/u/563043?v=3","gravatar_id":"","url":"https://api.github.com/users/johnmellor","html_url":"https://github.com/johnmellor","followers_url":"https://api.github.com/users/johnmellor/followers","following_url":"https://api.github.com/users/johnmellor/following{/other_user}","gists_url":"https://api.github.com/users/johnmellor/gists{/gist_id}","starred_url":"https://api.github.com/users/johnmellor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnmellor/subscriptions","organizations_url":"https://api.github.com/users/johnmellor/orgs","repos_url":"https://api.github.com/users/johnmellor/repos","events_url":"https://api.github.com/users/johnmellor/events{/privacy}","received_events_url":"https://api.github.com/users/johnmellor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-27T17:56:05Z","updated_at":"2015-08-28T09:04:20Z","closed_at":"2015-08-27T19:28:43Z","pull_request":{"url":"https://api.github.com/repos/w3c/testharness.js/pulls/144","html_url":"https://github.com/w3c/testharness.js/pull/144","diff_url":"https://github.com/w3c/testharness.js/pull/144.diff","patch_url":"https://github.com/w3c/testharness.js/pull/144.patch"},"body":"As an alternative to https://github.com/w3c/testharness.js/pull/143, this pull request proposes to fix `assert_object_equals`.\r\n\r\nConsider the following tests:\r\n\r\n```js\r\ntest(function() {\r\n    assert_object_equals(false, true);\r\n}, \"1\");\r\ntest(function() {\r\n    assert_object_equals(1, true);\r\n}, \"2\");\r\ntest(function() {\r\n    assert_object_equals(false, {});\r\n}, \"3\");\r\ntest(function() {\r\n    assert_object_equals({}, false);\r\n}, \"4\");\r\ntest(function() {\r\n    assert_object_equals(\"abc\", [\"a\", \"b\", \"c\"]);\r\n}, \"5\");\r\ntest(function() {\r\n    assert_object_equals([\"a\", \"b\", \"c\"], \"abc\");\r\n}, \"6\");\r\ntest(function() {\r\n    assert_object_equals({a:{}}, {a:false});\r\n}, \"7\");\r\ntest(function() {\r\n    assert_object_equals({b:{}}, {b:null});\r\n}, \"8\");\r\ntest(function() {\r\n    assert_object_equals({c:null}, {c:{}});\r\n}, \"9\");\r\ntest(function() {\r\n    assert_object_equals({d:false}, {d:{}});\r\n}, \"10\");\r\ntest(function() {\r\n    assert_object_equals({x:{y:{z:false}}}, {x:{y:{z:true}}});\r\n}, \"11\");\r\n```\r\n\r\nPreviously, the first 8 would incorrectly pass, and the last 3 would\r\ngive confusing error messages:\r\n\r\n```\r\nFAIL 9 assert_object_equals: property \"c\" expected object \"[object Object]\" got object \"[object Object]\"\r\nFAIL 10 assert_object_equals: property \"d\" expected object \"[object Object]\" got object \"[object Object]\"\r\nFAIL 11 assert_object_equals: property \"z\" expected object \"[object Object]\" got object \"[object Object]\"\r\n```\r\n\r\nAfter this patch, all the cases fail correctly and have clear error messages:\r\n\r\n```\r\nFAIL 1 assert_object_equals: expected true but got false\r\nFAIL 2 assert_object_equals: expected (boolean) true but got (number) 1\r\nFAIL 3 assert_object_equals: expected (object) object \"[object Object]\" but got (boolean) false\r\nFAIL 4 assert_object_equals: expected (boolean) false but got (object) object \"[object Object]\"\r\nFAIL 5 assert_object_equals: expected (object) [\"a\", \"b\", \"c\"] but got (string) \"abc\"\r\nFAIL 6 assert_object_equals: expected (string) \"abc\" but got (object) [\"a\", \"b\", \"c\"]\r\nFAIL 7 assert_object_equals: property [\"a\"]: expected (boolean) false but got (object) object \"[object Object]\"\r\nFAIL 8 assert_object_equals: property [\"b\"]: expected null but got object \"[object Object]\"\r\nFAIL 9 assert_object_equals: property [\"c\"]: expected object \"[object Object]\" but got null\r\nFAIL 10 assert_object_equals: property [\"d\"]: expected (object) object \"[object Object]\" but got (boolean) false\r\nFAIL 11 assert_object_equals: property [\"x\"][\"y\"][\"z\"]: expected true but got false\r\n```"},"comment":{"url":"https://api.github.com/repos/w3c/testharness.js/issues/comments/135696196","html_url":"https://github.com/w3c/testharness.js/pull/144#issuecomment-135696196","issue_url":"https://api.github.com/repos/w3c/testharness.js/issues/144","id":135696196,"user":{"login":"jgraham","id":294864,"avatar_url":"https://avatars.githubusercontent.com/u/294864?v=3","gravatar_id":"","url":"https://api.github.com/users/jgraham","html_url":"https://github.com/jgraham","followers_url":"https://api.github.com/users/jgraham/followers","following_url":"https://api.github.com/users/jgraham/following{/other_user}","gists_url":"https://api.github.com/users/jgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/jgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgraham/subscriptions","organizations_url":"https://api.github.com/users/jgraham/orgs","repos_url":"https://api.github.com/users/jgraham/repos","events_url":"https://api.github.com/users/jgraham/events{/privacy}","received_events_url":"https://api.github.com/users/jgraham/received_events","type":"User","site_admin":false},"created_at":"2015-08-28T09:04:20Z","updated_at":"2015-08-28T09:04:20Z","body":"Thank you for the patch, but I really really just want this to die. It's too complex to be good for testing."}}