From a3d91b12e553f65fc4b72f5b5f1646f2fc0ab81d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 10 Oct 2018 16:46:15 +0200 Subject: [PATCH] Intl.ListFormat: Add a test for unsupported options combinations. This was changed in https://github.com/tc39/proposal-intl-list-format/pull/27. --- .../constructor/options-bad-combinations.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/intl402/ListFormat/constructor/constructor/options-bad-combinations.js diff --git a/test/intl402/ListFormat/constructor/constructor/options-bad-combinations.js b/test/intl402/ListFormat/constructor/constructor/options-bad-combinations.js new file mode 100644 index 0000000000..01423b86f2 --- /dev/null +++ b/test/intl402/ListFormat/constructor/constructor/options-bad-combinations.js @@ -0,0 +1,22 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.ListFormat +description: Checks handling of invalid value for the type option to the ListFormat constructor. +info: | + InitializeListFormat (listFormat, locales, options) + 7. Let type be GetOption(options, "type", "string", « "conjunction", "disjunction", "unit" », "conjunction"). +features: [Intl.ListFormat] +---*/ + +const invalidTypes = [ + "conjunction", + "disjunction", +]; + +for (const type of invalidTypes) { + assert.throws(RangeError, function() { + new Intl.ListFormat([], { style: "narrow", type }); + }, `${type} is an invalid type option value when style is narrow.`); +}