OLD | NEW |
(Empty) | |
| 1 'use strict'; |
| 2 |
| 3 self.getterRejects = (t, obj, getterName, target) => { |
| 4 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; |
| 5 |
| 6 return promise_rejects(t, new TypeError(), getter.call(target)); |
| 7 }; |
| 8 |
| 9 self.methodRejects = (t, obj, methodName, target) => { |
| 10 const method = obj[methodName]; |
| 11 |
| 12 return promise_rejects(t, new TypeError(), method.call(target)); |
| 13 }; |
| 14 |
| 15 self.getterThrows = (obj, getterName, target) => { |
| 16 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; |
| 17 |
| 18 assert_throws(new TypeError(), () => getter.call(target), getterName + ' shoul
d throw a TypeError'); |
| 19 }; |
| 20 |
| 21 self.methodThrows = (obj, methodName, target, args) => { |
| 22 const method = obj[methodName]; |
| 23 |
| 24 assert_throws(new TypeError(), () => method.apply(target, args), methodName +
' should throw a TypeError'); |
| 25 }; |
| 26 |
| 27 self.garbageCollect = () => { |
| 28 if (self.gc) { |
| 29 // Use --expose_gc for V8 (and Node.js) |
| 30 // Exposed in SpiderMonkey shell as well |
| 31 self.gc(); |
| 32 } else if (self.GCController) { |
| 33 // Present in some WebKit development environments |
| 34 GCController.collect(); |
| 35 } else { |
| 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 ' + |
| 38 'coverage will be suboptimal.'); |
| 39 /* eslint-enable no-console */ |
| 40 } |
| 41 }; |
| 42 |
| 43 self.delay = ms => new Promise(resolve => setTimeout(resolve, ms)); |
OLD | NEW |