summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/ListFormat/prototype/format/iterable-getiterator-throw.js
blob: 88d701a832f0de6fc0867fd73157fdc39c6a414f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2019 Google Inc.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.ListFormat.prototype.format
description: >
    Checks the behavior of Abstract Operation StringListFromIterable    called by Intl.ListFormat.prototype.format() while the GetIterator
    throws error.
info: |
    StringListFromIterable
    1. If iterable is undefined, then
      a. Return a new empty List.
    2. Let iteratorRecord be ? GetIterator(iterable).
features: [Intl.ListFormat]
---*/

function CustomError() {}

let lf = new Intl.ListFormat();
// Test the failure case.
let get_iterator_throw_error = {
  [Symbol.iterator]() {
    throw new CustomError();
  }
};
assert.throws(CustomError,
    ()=> {lf.format(get_iterator_throw_error)});

reportCompare(0, 0);