promiseHelper.js (864B)
1 // Copyright (c) 2017 Rick Waldron. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: > 5 Including promiseHelper.js will expose a function: 6 7 checkSequence 8 9 To ensure execution order of some async chain, checkSequence accepts an array 10 of numbers, each added during some operation, and verifies that they 11 are in numeric order. 12 13 includes: [promiseHelper.js] 14 ---*/ 15 16 assert(checkSequence([1, 2, 3, 4, 5])); 17 18 var threw = false; 19 20 try { 21 checkSequence([2, 1, 3, 4, 5]); 22 } catch(err) { 23 threw = true; 24 if (err.constructor !== Test262Error) { 25 throw new Error( 26 'Expected a Test262Error, but a "' + err.constructor.name + 27 '" was thrown.' 28 ); 29 } 30 } 31 32 if (threw === false) { 33 throw new Error('Expected a Test262Error, but no error was thrown.'); 34 } 35 36 37 reportCompare(0, 0);