promiseHelper.js 619 B

1234567891011121314151617181920
  1. // Copyright (C) 2017 Ecma International. All rights reserved.
  2. // This code is governed by the BSD license found in the LICENSE file.
  3. /*---
  4. description: |
  5. Check that an array contains a numeric sequence starting at 1
  6. and incrementing by 1 for each entry in the array. Used by
  7. Promise tests to assert the order of execution in deep Promise
  8. resolution pipelines.
  9. ---*/
  10. function checkSequence(arr, message) {
  11. arr.forEach(function(e, i) {
  12. if (e !== (i+1)) {
  13. $ERROR((message ? message : "Steps in unexpected sequence:") +
  14. " '" + arr.join(',') + "'");
  15. }
  16. });
  17. return true;
  18. }