cc494cd3f9
Change the initial value of breakType to undefined Store break type into bits Change the algorithm Bug: v8:6891 Change-Id: Id2cc1e90c28d92364318928fc8a377f172ebb339 Reviewed-on: https://chromium-review.googlesource.com/c/1374996 Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#58298}
16 lines
566 B
JavaScript
16 lines
566 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.
|
|
|
|
// Flags: --harmony-intl-segmenter
|
|
|
|
const text = "Hello World, Test 123! Foo Bar. How are you?";
|
|
for (const granularity of ["grapheme", "word", "sentence", "line"]) {
|
|
const segmenter = new Intl.Segmenter("en", { granularity });
|
|
const iter = segmenter.segment(text);
|
|
|
|
assertEquals("number", typeof iter.position);
|
|
assertEquals(0, iter.position);
|
|
assertEquals(undefined, iter.breakType);
|
|
}
|