test262-automation 39d5434ab1 [v8-test262-automation] Updated curation log with latest revision sha's from export and changed files.
sourceRevisionAtLastExport: f85a3554 targetRevisionAtLastExport: 6bb8f41e0a
2019-02-04 19:41:17 +00:00

27 lines
906 B
JavaScript

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Check plural w/ formatToParts
// http://tc39.github.io/proposal-intl-relative-time/
let rtf = new Intl.RelativeTimeFormat();
// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit )
function verifyElement(part, expectedUnit) {
assertEquals(true, part.type == 'literal' || part.type == 'integer');
assertEquals('string', typeof part.value);
if (part.type == 'integer') {
assertEquals('string', typeof part.unit);
assertEquals(expectedUnit, part.unit);
}
};
['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'].forEach(
function(unit) {
rtf.formatToParts(100, unit + 's').forEach(
function(part) {
verifyElement(part, unit);
});
});