(object, object_name, operations)
| 2 | // META: script=/wasm/jsapi/assertions.js |
| 3 | |
| 4 | function test_operations(object, object_name, operations) { |
| 5 | for (const [name, length] of operations) { |
| 6 | test(() => { |
| 7 | const propdesc = Object.getOwnPropertyDescriptor(object, name); |
| 8 | assert_equals(typeof propdesc, "object"); |
| 9 | assert_true(propdesc.writable, "writable"); |
| 10 | assert_true(propdesc.enumerable, "enumerable"); |
| 11 | assert_true(propdesc.configurable, "configurable"); |
| 12 | assert_equals(propdesc.value, object[name]); |
| 13 | }, `${object_name}.${name}`); |
| 14 | |
| 15 | test(() => { |
| 16 | assert_function_name(object[name], name, `${object_name}.${name}`); |
| 17 | }, `${object_name}.${name}: name`); |
| 18 | |
| 19 | test(() => { |
| 20 | assert_function_length(object[name], length, `${object_name}.${name}`); |
| 21 | }, `${object_name}.${name}: length`); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | function test_attributes(object, object_name, attributes) { |
| 26 | for (const [name, mutable] of attributes) { |
no test coverage detected