2018-10-06 08:53:28 +00:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
// Flags: --harmony-intl-segmenter
|
|
|
|
|
|
|
|
const text = "Hello World, Test 123! Foo Bar. How are you?";
|
2019-01-19 09:02:15 +00:00
|
|
|
for (const granularity of ["grapheme", "word", "sentence"]) {
|
2018-10-15 18:21:43 +00:00
|
|
|
const segmenter = new Intl.Segmenter("en", { granularity });
|
|
|
|
const iter = segmenter.segment(text);
|
2018-10-06 08:53:28 +00:00
|
|
|
|
2018-12-17 23:09:06 +00:00
|
|
|
assertEquals("number", typeof iter.index);
|
|
|
|
assertEquals(0, iter.index);
|
2018-12-17 22:11:14 +00:00
|
|
|
assertEquals(undefined, iter.breakType);
|
2018-10-15 18:21:43 +00:00
|
|
|
}
|