| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 | 2 |
| 3 self.getterRejects = (t, obj, getterName, target) => { | 3 self.getterRejects = (t, obj, getterName, target) => { |
| 4 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; | 4 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; |
| 5 | 5 |
| 6 return promise_rejects(t, new TypeError(), getter.call(target)); | 6 return promise_rejects(t, new TypeError(), getter.call(target)); |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 self.methodRejects = (t, obj, methodName, target) => { | 9 self.methodRejects = (t, obj, methodName, target, args) => { |
| 10 const method = obj[methodName]; | 10 const method = obj[methodName]; |
| 11 | 11 |
| 12 return promise_rejects(t, new TypeError(), method.call(target)); | 12 return promise_rejects(t, new TypeError(), method.apply(target, args)); |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 self.getterThrows = (obj, getterName, target) => { | 15 self.getterThrows = (obj, getterName, target) => { |
| 16 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; | 16 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; |
| 17 | 17 |
| 18 assert_throws(new TypeError(), () => getter.call(target), getterName + ' shoul
d throw a TypeError'); | 18 assert_throws(new TypeError(), () => getter.call(target), getterName + ' shoul
d throw a TypeError'); |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 self.methodThrows = (obj, methodName, target, args) => { | 21 self.methodThrows = (obj, methodName, target, args) => { |
| 22 const method = obj[methodName]; | 22 const method = obj[methodName]; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 GCController.collect(); | 34 GCController.collect(); |
| 35 } else { | 35 } else { |
| 36 /* eslint-disable no-console */ | 36 /* eslint-disable no-console */ |
| 37 console.warn('Tests are running without the ability to do manual garbage col
lection. They will still work, but ' + | 37 console.warn('Tests are running without the ability to do manual garbage col
lection. They will still work, but ' + |
| 38 'coverage will be suboptimal.'); | 38 'coverage will be suboptimal.'); |
| 39 /* eslint-enable no-console */ | 39 /* eslint-enable no-console */ |
| 40 } | 40 } |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 self.delay = ms => new Promise(resolve => step_timeout(resolve, ms)); | 43 self.delay = ms => new Promise(resolve => step_timeout(resolve, ms)); |
| 44 |
| 45 // For tests which verify that the implementation doesn't do something it should
n't, it's better not to use a |
| 46 // timeout. Instead, assume that any reasonable implementation is going to finis
h work after 2 times around the event |
| 47 // loop, and use flushAsyncEvents().then(() => assert_array_equals(...)); |
| 48 // Some tests include promise resolutions which may mean the test code takes a c
ouple of event loop visits itself. So go |
| 49 // around an extra 2 times to avoid complicating those tests. |
| 50 self.flushAsyncEvents = () => delay(0).then(() => delay(0)).then(() => delay(0))
.then(() => delay(0)); |
| OLD | NEW |