diff --git a/test/intl402/Segmenter/constructor/constructor/options-granularity-valid.js b/test/intl402/Segmenter/constructor/constructor/options-granularity-valid.js index 429bf73f0fb5c878f391bc4fd19630b6b55cbd9b..a1733885e30143fd132a52c58d9090c22384cfc7 100644 --- a/test/intl402/Segmenter/constructor/constructor/options-granularity-valid.js +++ b/test/intl402/Segmenter/constructor/constructor/options-granularity-valid.js @@ -7,7 +7,7 @@ description: Checks handling of valid values for the granularity option to the S info: | Intl.Segmenter ([ locales [ , options ]]) - 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence", "line" », "grapheme"). + 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence" », "grapheme"). 14. Set segmenter.[[SegmenterGranularity]] to granularity. features: [Intl.Segmenter] ---*/ @@ -17,8 +17,7 @@ const validOptions = [ ["grapheme", "grapheme"], ["word", "word"], ["sentence", "sentence"], - ["line", "line"], - [{ toString() { return "line"; } }, "line"], + [{ toString() { return "word"; } }, "word"], ]; for (const [granularity, expected] of validOptions) { diff --git a/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-invalid.js b/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-invalid.js deleted file mode 100644 index b1b892960aa3de6555585380abd392c7bb469bfe..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-invalid.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter -description: Checks handling of invalid value for the style option to the Segmenter constructor. -info: | - Intl.Segmenter ([ locales [ , options ]]) - - 9. Let lineBreakStyle be ? GetOption(options, "lineBreakStyle", "string", « "strict", "normal", "loose" », "normal"). - 15. If granularity is "line", - a. Set segmenter.[[SegmenterLineBreakStyle]] to r.[[lb]]. -features: [Intl.Segmenter] ----*/ - -const invalidOptions = [ - null, - 1, - "", - "giant", - "Strict", - "STRICT", - "strict\0", - "Normal", - "NORMAL", - "normal\0", - "Loose", - "LOOSE", - "loose\0", -]; - -for (const lineBreakStyle of invalidOptions) { - assert.throws(RangeError, function() { - new Intl.Segmenter([], { lineBreakStyle }); - }, `${lineBreakStyle} is an invalid style option value`); -} diff --git a/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-valid.js b/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-valid.js deleted file mode 100644 index 3b94f3a435942c1c1a113f931d6d9844b15a2e37..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/constructor/constructor/options-lineBreakStyle-valid.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter -description: Checks handling of valid values for the lineBreakStyle option to the Segmenter constructor. -info: | - Intl.Segmenter ([ locales [ , options ]]) - - 9. Let lineBreakStyle be ? GetOption(options, "lineBreakStyle", "string", « "strict", "normal", "loose" », "normal"). - 15. If granularity is "line", - a. Set segmenter.[[SegmenterLineBreakStyle]] to r.[[lb]]. -features: [Intl.Segmenter] ----*/ - -const validOptions = [ - [undefined, "normal"], - ["strict", "strict"], - ["normal", "normal"], - ["loose", "loose"], - [{ toString() { return "loose"; } }, "loose"], -]; - -for (const [lineBreakStyle, expected] of validOptions) { - const segmenter = new Intl.Segmenter([], { granularity: "line", lineBreakStyle }); - const resolvedOptions = segmenter.resolvedOptions(); - assert.sameValue(resolvedOptions.lineBreakStyle, expected); -} diff --git a/test/intl402/Segmenter/constructor/constructor/options-order.js b/test/intl402/Segmenter/constructor/constructor/options-order.js index 75cd81b7377556770d72d80d25985c6c07640705..1a896a091a7cf5fdc6f4ecf5c07b2b0b6cfd9f56 100644 --- a/test/intl402/Segmenter/constructor/constructor/options-order.js +++ b/test/intl402/Segmenter/constructor/constructor/options-order.js @@ -8,8 +8,7 @@ info: | Intl.Segmenter ([ locales [ , options ]]) 7. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit"). - 9. Let lineBreakStyle be ? GetOption(options, "lineBreakStyle", "string", « "strict", "normal", "loose" », "normal"). - 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence", "line" », "grapheme"). + 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence" », "grapheme"). includes: [compareArray.js] features: [Intl.Segmenter] ---*/ @@ -49,8 +48,6 @@ new Intl.Segmenter([], { assert.compareArray(callOrder, [ "localeMatcher", "localeMatcher toString", - "lineBreakStyle", - "lineBreakStyle toString", "granularity", "granularity toString", ]); diff --git a/test/intl402/Segmenter/constructor/constructor/options-throwing-getters.js b/test/intl402/Segmenter/constructor/constructor/options-throwing-getters.js index bb34252ba1992b30d6463e3926fb0e9f8c1581d6..1d440bafb83245c59d8a985ba413625175fe70e2 100644 --- a/test/intl402/Segmenter/constructor/constructor/options-throwing-getters.js +++ b/test/intl402/Segmenter/constructor/constructor/options-throwing-getters.js @@ -11,7 +11,6 @@ function CustomError() {} const options = [ "localeMatcher", - "lineBreakStyle", "granularity", ]; diff --git a/test/intl402/Segmenter/constructor/constructor/options-toobject-prototype.js b/test/intl402/Segmenter/constructor/constructor/options-toobject-prototype.js index d4163990ca5f5c7115f5d0c9213cec96b89992a0..891b0778e0e57f890acc7a66a6b4d65629445081 100644 --- a/test/intl402/Segmenter/constructor/constructor/options-toobject-prototype.js +++ b/test/intl402/Segmenter/constructor/constructor/options-toobject-prototype.js @@ -13,11 +13,8 @@ features: [Intl.Segmenter] ---*/ Object.defineProperties(Object.prototype, { - "lineBreakStyle": { - value: "loose", - }, "granularity": { - value: "line", + value: "word", }, }) @@ -32,8 +29,6 @@ const optionsArguments = [ for (const options of optionsArguments) { const segmenter = new Intl.Segmenter([], options); const resolvedOptions = segmenter.resolvedOptions(); - assert.sameValue(resolvedOptions.lineBreakStyle, "loose", - `options argument ${String(options)} should yield the correct value for "lineBreakStyle"`); - assert.sameValue(resolvedOptions.granularity, "line", + assert.sameValue(resolvedOptions.granularity, "word", `options argument ${String(options)} should yield the correct value for "granularity"`); } diff --git a/test/intl402/Segmenter/constructor/constructor/options-valid-combinations.js b/test/intl402/Segmenter/constructor/constructor/options-valid-combinations.js index 027f9e388716bbfded7bb9ac89107a62a775e9ab..d66b64642cef9c48c8ee37a1b9da8f9e541accbc 100644 --- a/test/intl402/Segmenter/constructor/constructor/options-valid-combinations.js +++ b/test/intl402/Segmenter/constructor/constructor/options-valid-combinations.js @@ -7,16 +7,12 @@ description: Checks handling of valid values for the granularity option to the S info: | Intl.Segmenter ([ locales [ , options ]]) - 9. Let lineBreakStyle be ? GetOption(options, "lineBreakStyle", "string", « "strict", "normal", "loose" », "normal"). - 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence", "line" », "grapheme"). + 13. Let granularity be ? GetOption(options, "granularity", "string", « "grapheme", "word", "sentence" », "grapheme"). 14. Set segmenter.[[SegmenterGranularity]] to granularity. - 15. If granularity is "line", - a. Set segmenter.[[SegmenterLineBreakStyle]] to r.[[lb]]. features: [Intl.Segmenter] ---*/ -const lineBreakStyleOptions = ["strict", "normal", "loose"]; -const granularityOptions = ["grapheme", "word", "sentence", "line"]; +const granularityOptions = ["grapheme", "word", "sentence"]; const combinations = []; combinations.push([ @@ -25,35 +21,16 @@ combinations.push([ undefined, ]); -for (const lineBreakStyle of lineBreakStyleOptions) { - combinations.push([ - { lineBreakStyle }, - "grapheme", - undefined, - ]); -} - for (const granularity of granularityOptions) { combinations.push([ { granularity }, granularity, - granularity === "line" ? "normal" : undefined, + undefined, ]); } -for (const lineBreakStyle of lineBreakStyleOptions) { - for (const granularity of granularityOptions) { - combinations.push([ - { granularity, lineBreakStyle }, - granularity, - granularity === "line" ? lineBreakStyle : undefined, - ]); - } -} - for (const [input, granularity, lineBreakStyle] of combinations) { const segmenter = new Intl.Segmenter([], input); const resolvedOptions = segmenter.resolvedOptions(); assert.sameValue(resolvedOptions.granularity, granularity); - assert.sameValue(resolvedOptions.lineBreakStyle, lineBreakStyle); } diff --git a/test/intl402/Segmenter/iterator/granularity.js b/test/intl402/Segmenter/iterator/granularity.js index c87350e06ca29a958ee8e6626d21713a414fdf0f..e9264a3acbf297c73a0c326ec586f016cd3509a6 100644 --- a/test/intl402/Segmenter/iterator/granularity.js +++ b/test/intl402/Segmenter/iterator/granularity.js @@ -8,7 +8,7 @@ features: [Intl.Segmenter] ---*/ const text = "Hello World, Test 123! Foo Bar. How are you?"; -for (const granularity of ["grapheme", "word", "sentence", "line"]) { +for (const granularity of ["grapheme", "word", "sentence"]) { const segmenter = new Intl.Segmenter("en", { granularity }); const iter = segmenter.segment(text); diff --git a/test/intl402/Segmenter/prototype/resolvedOptions/order.js b/test/intl402/Segmenter/prototype/resolvedOptions/order.js index 82fc705f2f92ae86310346496efc934d578b2a13..3edc8d00d63044cb92cd1f964dc7f7be5781cb35 100644 --- a/test/intl402/Segmenter/prototype/resolvedOptions/order.js +++ b/test/intl402/Segmenter/prototype/resolvedOptions/order.js @@ -9,13 +9,12 @@ features: [Intl.Segmenter] ---*/ const options = new Intl.Segmenter([], { - "granularity": "line", + "granularity": "word", }).resolvedOptions(); const expected = [ "locale", "granularity", - "lineBreakStyle", ]; assert.compareArray(Object.getOwnPropertyNames(options), expected); diff --git a/test/intl402/Segmenter/prototype/resolvedOptions/type-with-lbs.js b/test/intl402/Segmenter/prototype/resolvedOptions/type-with-lbs.js deleted file mode 100644 index 72ee4e2823d9f9d125f0c96698458ec95293c02d..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/resolvedOptions/type-with-lbs.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.resolvedOptions -description: Checks the properties of the result of Intl.Segmenter.prototype.resolvedOptions(). -info: | - Intl.Segmenter.prototype.resolvedOptions () - - 3. Let options be ! ObjectCreate(%ObjectPrototype%). - 4. For each row of Table 1, except the header row, do - c. If v is not undefined, then - i. Perform ! CreateDataPropertyOrThrow(options, p, v). -includes: [propertyHelper.js] -features: [Intl.Segmenter] ----*/ - -const rtf = new Intl.Segmenter("en-us", { "lineBreakStyle": "loose", "granularity": "line" }); -const options = rtf.resolvedOptions(); -assert.sameValue(Object.getPrototypeOf(options), Object.prototype, "Prototype"); - -verifyProperty(options, "locale", { - value: "en-US", - writable: true, - enumerable: true, - configurable: true, -}); - -verifyProperty(options, "granularity", { - value: "line", - writable: true, - enumerable: true, - configurable: true, -}); - -verifyProperty(options, "lineBreakStyle", { - value: "loose", - writable: true, - enumerable: true, - configurable: true, -}); diff --git a/test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js b/test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js deleted file mode 100644 index f908f09af8932221eb86c56c62a17ea257f2066e..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -let breakCounts = {}; -for (const locale of ["en", "fr", "ja", "zh", "ko"]) { - for (const lineBreakStyle of ["strict", "normal", "loose"]) { - const seg = new Intl.Segmenter( - [locale], {granularity: "line", lineBreakStyle: lineBreakStyle}); - let opportunity = 0; - for (const text of [ - // We know the following data caused different line break results between - // different modes. - // https://www.w3.org/TR/css-text-3/#propdef-line-break - // Japanese small kana or the Katakana-Hiragana prolonged sound mark - "ã‚ãーãƒãƒ¼ã‚ーã„ーãーãƒãƒ¼", - // hyphens: - // †U+2010, – U+2013, 〜 U+301C, ã‚ U+30A0 - "ABCâ€DEF–GHI〜JKLã‚ MNO", - // iteration marks: - // 々 U+3005, 〻 U+303B, ã‚ U+309D, ã‚ž U+309E, ヽ U+30FD, ヾ U+30FE - "ã‚々ã‚〻ã‚ã‚ã‚ã‚žã‚ヽã‚ヾã‚", - // centered punctuation marks: - // ・ U+30FB, : U+FF1A, ï¼› U+FF1B, ï½¥ U+FF65, ‼ U+203C - "ABC・DEF:GHIï¼›JKLï½¥MNO‼PQR", - // centered punctuation marks: - // ⇠U+2047, ∠U+2048, ≠U+2049, ï¼ U+FF01, ? U+FF1F - "ABCâ‡DEFâˆGHIâ‰JKLï¼MNO?PQR", - ]) { - const iter = seg.segment(text); - while (!iter.following()) { - opportunity++; - } - } - breakCounts[locale + "-" + lineBreakStyle] = opportunity; - } -} -// In Japanese -// Just test the break count in loose mode is greater than normal mode. -assert(breakCounts["ja-loose"] > breakCounts["ja-normal"]); -// and test the break count in normal mode is greater than strict mode. -assert(breakCounts["ja-normal"] > breakCounts["ja-strict"]); -// In Chinese -// Just test the break count in loose mode is greater than normal mode. -assert(breakCounts["zh-loose"] > breakCounts["zh-normal"]); -// and test the break count in normal mode is greater than strict mode. -assert(breakCounts["zh-normal"] > breakCounts["zh-strict"]); -// In English, French and Korean -assert(breakCounts["en-loose"] >= breakCounts["en-normal"]); -assert(breakCounts["fr-loose"] >= breakCounts["fr-normal"]); -assert(breakCounts["ko-loose"] >= breakCounts["ko-normal"]); -// and test the break count in normal mode is greater than strict mode. -assert(breakCounts["en-normal"] > breakCounts["en-strict"]); -assert(breakCounts["fr-normal"] > breakCounts["fr-strict"]); -assert(breakCounts["ko-normal"] > breakCounts["ko-strict"]); diff --git a/test/intl402/Segmenter/prototype/segment/segment-line-following.js b/test/intl402/Segmenter/prototype/segment/segment-line-following.js deleted file mode 100644 index 5d6c1d72af78987b4856a736ff059eb1c4424f6b..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line-following.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "ΣοβαÏÎÏ‚ ενστάσεις Κομισιόν για τον Ï€Ïοϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке роÑÑийÑких С-400 раÑценили как вызов СШÐ", // Russian - "×”×¨×•×¤× ×©×”×¦×™×œ × ×©×™× ×•×”× ×¢×¨×” ששועבדה ×¢", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دÙع المزيد", // Arabic - "à¤à¤¾à¤°à¤¤ की à¤à¤¸ 400 मिसाइल के मà¥à¤•à¤¾à¤¬à¤²à¥‡ पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட௠அலரà¯à®Ÿà¯ எசà¯à®šà®°à®¿à®•à¯à®•à¯ˆ; பà¯à®¤à¯à®šà¯à®šà¯‡à®°à®¿à®¯à®¿à®²à¯ நாளை அரச௠விடà¯à®®à¯à®±à¯ˆ!", // Tamil - "'ఉతà±à°¤à°°à±à°µà±à°²à± అందే వరకౠఓటరà±à°² à°¤à±à°¦à°¿ జాబితానౠవెబà±â€Œà°¸à±ˆà°Ÿà±à°²à±‹ పెటà±à°Ÿà°µà°¦à±à°¦à±'", // Telugu - "å°åŒ—》抹黑柯P失敗?朱å¸æ’酸:姚文智氣pupu嗆大è€é—†", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าà¸à¸²à¸§à¸²à¸ªà¹€à¸œà¸¢à¸„นร้à¸à¸‡à¹€à¸£à¸µà¸¢à¸™à¸£à¸±à¸šà¸œà¸¥à¸à¸£à¸£à¸¡à¹à¸¥à¹‰à¸§", // Thai - "ä¹å·žåŒ—部ã®ä¸€éƒ¨ãŒæš´é¢¨åŸŸã«å…¥ã‚Šã¾ã—ãŸ(æ—¥ç›´äºˆå ±å£« 2018å¹´10月06æ—¥) - 日本気象å”会 tenki.jp", // Japanese - "ë²•ì› â€œë‹¤ìŠ¤ 지분 처분권·수ìµê¶Œ ëª¨ë‘ MBê°€ ë³´ìœ â€", // Korean - ]) { - const iter = seg.segment(text); - let prev = 0; - let segments = []; - while (!iter.following()) { - assert(["soft", "hard"].includes(iter.breakType), iter.breakType); - assert(iter.index >= 0); - assert(iter.index <= text.length); - assert(iter.index > prev); - segments.push(text.substring(prev, iter.index)); - prev = iter.index; - } - assert.sameValue(text, segments.join("")); -} diff --git a/test/intl402/Segmenter/prototype/segment/segment-line-iterable.js b/test/intl402/Segmenter/prototype/segment/segment-line-iterable.js deleted file mode 100644 index ccf206eea1384085f0143a10927f3fd2f5ab5edd..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line-iterable.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "ΣοβαÏÎÏ‚ ενστάσεις Κομισιόν για τον Ï€Ïοϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке роÑÑийÑких С-400 раÑценили как вызов СШÐ", // Russian - "×”×¨×•×¤× ×©×”×¦×™×œ × ×©×™× ×•×”× ×¢×¨×” ששועבדה ×¢", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دÙع المزيد", // Arabic - "à¤à¤¾à¤°à¤¤ की à¤à¤¸ 400 मिसाइल के मà¥à¤•à¤¾à¤¬à¤²à¥‡ पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட௠அலரà¯à®Ÿà¯ எசà¯à®šà®°à®¿à®•à¯à®•à¯ˆ; பà¯à®¤à¯à®šà¯à®šà¯‡à®°à®¿à®¯à®¿à®²à¯ நாளை அரச௠விடà¯à®®à¯à®±à¯ˆ!", // Tamil - "'ఉతà±à°¤à°°à±à°µà±à°²à± అందే వరకౠఓటరà±à°² à°¤à±à°¦à°¿ జాబితానౠవెబà±â€Œà°¸à±ˆà°Ÿà±à°²à±‹ పెటà±à°Ÿà°µà°¦à±à°¦à±'", // Telugu - "å°åŒ—》抹黑柯P失敗?朱å¸æ’酸:姚文智氣pupu嗆大è€é—†", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าà¸à¸²à¸§à¸²à¸ªà¹€à¸œà¸¢à¸„นร้à¸à¸‡à¹€à¸£à¸µà¸¢à¸™à¸£à¸±à¸šà¸œà¸¥à¸à¸£à¸£à¸¡à¹à¸¥à¹‰à¸§", // Thai - "ä¹å·žåŒ—部ã®ä¸€éƒ¨ãŒæš´é¢¨åŸŸã«å…¥ã‚Šã¾ã—ãŸ(æ—¥ç›´äºˆå ±å£« 2018å¹´10月06æ—¥) - 日本気象å”会 tenki.jp", // Japanese - "ë²•ì› â€œë‹¤ìŠ¤ 지분 처분권·수ìµê¶Œ ëª¨ë‘ MBê°€ ë³´ìœ â€", // Korean - ]) { - let segments = []; - // Create another %SegmentIterator% to compare with result from the one that - // created in the for of loop. - let iter = seg.segment(text); - let prev = 0; - for (const v of seg.segment(text)) { - assert(["soft", "hard"].includes(v.breakType), v.breakType); - assert.sameValue("string", typeof v.segment); - assert(v.segment.length > 0); - segments.push(v.segment); - - // manually advance the iter. - assert.sameValue(iter.following(), false); - assert.sameValue(iter.breakType, v.breakType); - assert.sameValue(text.substring(prev, iter.index), v.segment); - prev = iter.index; - } - assert(iter.following()); - assert.sameValue(text, segments.join('')); -} diff --git a/test/intl402/Segmenter/prototype/segment/segment-line-next.js b/test/intl402/Segmenter/prototype/segment/segment-line-next.js deleted file mode 100644 index dc3d8a4f08af303773b1ecd94ab86c1f5a0fbf4a..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line-next.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "ΣοβαÏÎÏ‚ ενστάσεις Κομισιόν για τον Ï€Ïοϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке роÑÑийÑких С-400 раÑценили как вызов СШÐ", // Russian - "×”×¨×•×¤× ×©×”×¦×™×œ × ×©×™× ×•×”× ×¢×¨×” ששועבדה ×¢", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دÙع المزيد", // Arabic - "à¤à¤¾à¤°à¤¤ की à¤à¤¸ 400 मिसाइल के मà¥à¤•à¤¾à¤¬à¤²à¥‡ पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட௠அலரà¯à®Ÿà¯ எசà¯à®šà®°à®¿à®•à¯à®•à¯ˆ; பà¯à®¤à¯à®šà¯à®šà¯‡à®°à®¿à®¯à®¿à®²à¯ நாளை அரச௠விடà¯à®®à¯à®±à¯ˆ!", // Tamil - "'ఉతà±à°¤à°°à±à°µà±à°²à± అందే వరకౠఓటరà±à°² à°¤à±à°¦à°¿ జాబితానౠవెబà±â€Œà°¸à±ˆà°Ÿà±à°²à±‹ పెటà±à°Ÿà°µà°¦à±à°¦à±'", // Telugu - "å°åŒ—》抹黑柯P失敗?朱å¸æ’酸:姚文智氣pupu嗆大è€é—†", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าà¸à¸²à¸§à¸²à¸ªà¹€à¸œà¸¢à¸„นร้à¸à¸‡à¹€à¸£à¸µà¸¢à¸™à¸£à¸±à¸šà¸œà¸¥à¸à¸£à¸£à¸¡à¹à¸¥à¹‰à¸§", // Thai - "ä¹å·žåŒ—部ã®ä¸€éƒ¨ãŒæš´é¢¨åŸŸã«å…¥ã‚Šã¾ã—ãŸ(æ—¥ç›´äºˆå ±å£« 2018å¹´10月06æ—¥) - 日本気象å”会 tenki.jp", // Japanese - "ë²•ì› â€œë‹¤ìŠ¤ 지분 처분권·수ìµê¶Œ ëª¨ë‘ MBê°€ ë³´ìœ â€", // Korean - ]) { - const iter = seg.segment(text); - let segments = []; - let oldPos = -1; - for (let result = iter.next(); !result.done; result = iter.next()) { - const v = result.value; - assert(["soft", "hard"].includes(iter.breakType), iter.breakType); - assert.sameValue("string", typeof v.segment); - assert(v.segment.length > 0); - segments.push(v.segment); - assert.sameValue(typeof v.index, "number"); - assert(oldPos < v.index); - oldPos = v.index; - } - assert.sameValue(text, segments.join('')); -} diff --git a/test/intl402/Segmenter/prototype/segment/segment-line-preceding.js b/test/intl402/Segmenter/prototype/segment/segment-line-preceding.js deleted file mode 100644 index 1d66345bb3e93850516f2dccdbcb73bc73734daf..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line-preceding.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "ΣοβαÏÎÏ‚ ενστάσεις Κομισιόν για τον Ï€Ïοϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке роÑÑийÑких С-400 раÑценили как вызов СШÐ", // Russian - "×”×¨×•×¤× ×©×”×¦×™×œ × ×©×™× ×•×”× ×¢×¨×” ששועבדה ×¢", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دÙع المزيد", // Arabic - "à¤à¤¾à¤°à¤¤ की à¤à¤¸ 400 मिसाइल के मà¥à¤•à¤¾à¤¬à¤²à¥‡ पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட௠அலரà¯à®Ÿà¯ எசà¯à®šà®°à®¿à®•à¯à®•à¯ˆ; பà¯à®¤à¯à®šà¯à®šà¯‡à®°à®¿à®¯à®¿à®²à¯ நாளை அரச௠விடà¯à®®à¯à®±à¯ˆ!", // Tamil - "'ఉతà±à°¤à°°à±à°µà±à°²à± అందే వరకౠఓటరà±à°² à°¤à±à°¦à°¿ జాబితానౠవెబà±â€Œà°¸à±ˆà°Ÿà±à°²à±‹ పెటà±à°Ÿà°µà°¦à±à°¦à±'", // Telugu - "å°åŒ—》抹黑柯P失敗?朱å¸æ’酸:姚文智氣pupu嗆大è€é—†", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าà¸à¸²à¸§à¸²à¸ªà¹€à¸œà¸¢à¸„นร้à¸à¸‡à¹€à¸£à¸µà¸¢à¸™à¸£à¸±à¸šà¸œà¸¥à¸à¸£à¸£à¸¡à¹à¸¥à¹‰à¸§", // Thai - "ä¹å·žåŒ—部ã®ä¸€éƒ¨ãŒæš´é¢¨åŸŸã«å…¥ã‚Šã¾ã—ãŸ(æ—¥ç›´äºˆå ±å£« 2018å¹´10月06æ—¥) - 日本気象å”会 tenki.jp", // Japanese - "ë²•ì› â€œë‹¤ìŠ¤ 지분 처분권·수ìµê¶Œ ëª¨ë‘ MBê°€ ë³´ìœ â€", // Korean - ]) { - const iter = seg.segment(text); - let prev = text.length; - let segments = []; - iter.preceding(prev) - assert(["soft", "hard"].includes(iter.breakType), iter.breakType); - assert(iter.index >= 0); - assert(iter.index < prev); - segments.push(text.substring(iter.index, prev)); - prev = iter.index; - while (!iter.preceding()) { - assert(["soft", "hard"].includes(iter.breakType), iter.breakType); - assert(iter.index >= 0); - assert(iter.index <= text.length); - assert(iter.index < prev); - segments.push(text.substring(iter.index, prev)); - prev = iter.index; - } - assert.sameValue(text, segments.reverse().join("")); -} diff --git a/test/intl402/Segmenter/prototype/segment/segment-line.js b/test/intl402/Segmenter/prototype/segment/segment-line.js deleted file mode 100644 index 6cb77a047b843bbd40bcdf1b117ee0b3c30ab54a..0000000000000000000000000000000000000000 --- a/test/intl402/Segmenter/prototype/segment/segment-line.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-Intl.Segmenter.prototype.segment -description: Verifies the behavior for the "segment" function of the Segmenter prototype object. -info: | - Intl.Segmenter.prototype.segment( string ) -features: [Intl.Segmenter] ----*/ - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "ΣοβαÏÎÏ‚ ενστάσεις Κομισιόν για τον Ï€Ïοϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке роÑÑийÑких С-400 раÑценили как вызов СШÐ", // Russian - "×”×¨×•×¤× ×©×”×¦×™×œ × ×©×™× ×•×”× ×¢×¨×” ששועבדה ×¢", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دÙع المزيد", // Arabic - "à¤à¤¾à¤°à¤¤ की à¤à¤¸ 400 मिसाइल के मà¥à¤•à¤¾à¤¬à¤²à¥‡ पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட௠அலரà¯à®Ÿà¯ எசà¯à®šà®°à®¿à®•à¯à®•à¯ˆ; பà¯à®¤à¯à®šà¯à®šà¯‡à®°à®¿à®¯à®¿à®²à¯ நாளை அரச௠விடà¯à®®à¯à®±à¯ˆ!", // Tamil - "'ఉతà±à°¤à°°à±à°µà±à°²à± అందే వరకౠఓటరà±à°² à°¤à±à°¦à°¿ జాబితానౠవెబà±â€Œà°¸à±ˆà°Ÿà±à°²à±‹ పెటà±à°Ÿà°µà°¦à±à°¦à±'", // Telugu - "å°åŒ—》抹黑柯P失敗?朱å¸æ’酸:姚文智氣pupu嗆大è€é—†", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าà¸à¸²à¸§à¸²à¸ªà¹€à¸œà¸¢à¸„นร้à¸à¸‡à¹€à¸£à¸µà¸¢à¸™à¸£à¸±à¸šà¸œà¸¥à¸à¸£à¸£à¸¡à¹à¸¥à¹‰à¸§", // Thai - "ä¹å·žåŒ—部ã®ä¸€éƒ¨ãŒæš´é¢¨åŸŸã«å…¥ã‚Šã¾ã—ãŸ(æ—¥ç›´äºˆå ±å£« 2018å¹´10月06æ—¥) - 日本気象å”会 tenki.jp", // Japanese - "ë²•ì› â€œë‹¤ìŠ¤ 지분 처분권·수ìµê¶Œ ëª¨ë‘ MBê°€ ë³´ìœ â€", // Korean - ]) { - const iter = seg.segment(text); - assert.sameValue(undefined, iter.breakType); - assert.sameValue(0, iter.index); -}