From 0d07ed06c03e357a3044e0f62af3d56b45fb2a6b Mon Sep 17 00:00:00 2001 From: Ms2ger <Ms2ger@igalia.com> Date: Wed, 24 Oct 2018 12:11:08 +0200 Subject: [PATCH] Intl.Segmenter: Submit batch of V8 tests for segment(). --- .../segment}/segment-grapheme-following.js | 21 ++++++++----- .../segment}/segment-grapheme-iterable.js | 25 +++++++++------ .../segment}/segment-grapheme-next.js | 19 +++++++----- .../segment}/segment-grapheme-preceding.js | 27 +++++++++------- .../prototype/segment}/segment-grapheme.js | 15 ++++++--- .../segment}/segment-line-following-modes.js | 31 +++++++++++-------- .../segment}/segment-line-following.js | 21 ++++++++----- .../segment}/segment-line-iterable.js | 25 +++++++++------ .../prototype/segment}/segment-line-next.js | 19 +++++++----- .../segment}/segment-line-preceding.js | 27 +++++++++------- .../prototype/segment}/segment-line.js | 15 ++++++--- .../segment}/segment-sentence-following.js | 21 ++++++++----- .../segment}/segment-sentence-iterable.js | 25 +++++++++------ .../segment}/segment-sentence-next.js | 19 +++++++----- .../segment}/segment-sentence-preceding.js | 27 +++++++++------- .../prototype/segment}/segment-sentence.js | 15 ++++++--- .../segment}/segment-word-following.js | 21 ++++++++----- .../segment}/segment-word-iterable.js | 25 +++++++++------ .../prototype/segment}/segment-word-next.js | 19 +++++++----- .../segment}/segment-word-preceding.js | 27 +++++++++------- .../prototype/segment}/segment-word.js | 15 ++++++--- 21 files changed, 282 insertions(+), 177 deletions(-) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-grapheme-following.js (81%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-grapheme-iterable.js (78%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-grapheme-next.js (81%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-grapheme-preceding.js (78%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-grapheme.js (83%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line-following-modes.js (66%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line-following.js (80%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line-iterable.js (78%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line-next.js (81%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line-preceding.js (77%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-line.js (83%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-sentence-following.js (80%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-sentence-iterable.js (78%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-sentence-next.js (81%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-sentence-preceding.js (77%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-sentence.js (83%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-word-following.js (80%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-word-iterable.js (78%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-word-next.js (81%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-word-preceding.js (77%) rename {implementation-contributed/v8/intl/segmenter => test/intl402/Segmenter/prototype/segment}/segment-word.js (83%) diff --git a/implementation-contributed/v8/intl/segmenter/segment-grapheme-following.js b/test/intl402/Segmenter/prototype/segment/segment-grapheme-following.js similarity index 81% rename from implementation-contributed/v8/intl/segmenter/segment-grapheme-following.js rename to test/intl402/Segmenter/prototype/segment/segment-grapheme-following.js index 0a824c0fb3..6e533386b2 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-grapheme-following.js +++ b/test/intl402/Segmenter/prototype/segment/segment-grapheme-following.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "grapheme"}) for (const text of [ @@ -27,12 +32,12 @@ for (const text of [ let prev = 0; let segments = []; while (!iter.following()) { - assertEquals(undefined, iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position > prev); + assert.sameValue(undefined, iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position > prev); segments.push(text.substring(prev, iter.position)); prev = iter.position; } - assertEquals(text, segments.join("")); + assert.sameValue(text, segments.join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-grapheme-iterable.js b/test/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js similarity index 78% rename from implementation-contributed/v8/intl/segmenter/segment-grapheme-iterable.js rename to test/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js index 50cf5db57f..41b693f351 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-grapheme-iterable.js +++ b/test/intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "grapheme"}) for (const text of [ @@ -29,17 +34,17 @@ for (const text of [ let iter = seg.segment(text); let prev = 0; for (const v of seg.segment(text)) { - assertEquals(undefined, v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert.sameValue(undefined, v.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); // manually advance the iter. assertFalse(iter.following()); - assertEquals(iter.breakType, v.breakType); - assertEquals(text.substring(prev, iter.position), v.segment); + assert.sameValue(iter.breakType, v.breakType); + assert.sameValue(text.substring(prev, iter.position), v.segment); prev = iter.position; } - assertTrue(iter.following()); - assertEquals(text, segments.join('')); + assert(iter.following()); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-grapheme-next.js b/test/intl402/Segmenter/prototype/segment/segment-grapheme-next.js similarity index 81% rename from implementation-contributed/v8/intl/segmenter/segment-grapheme-next.js rename to test/intl402/Segmenter/prototype/segment/segment-grapheme-next.js index f9adc27c13..6a31f6866e 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-grapheme-next.js +++ b/test/intl402/Segmenter/prototype/segment/segment-grapheme-next.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "grapheme"}) for (const text of [ @@ -27,10 +32,10 @@ for (const text of [ let segments = []; for (let result = iter.next(); !result.done; result = iter.next()) { const v = result.value; - assertEquals(undefined, v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert.sameValue(undefined, v.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); } - assertEquals(text, segments.join('')); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-grapheme-preceding.js b/test/intl402/Segmenter/prototype/segment/segment-grapheme-preceding.js similarity index 78% rename from implementation-contributed/v8/intl/segmenter/segment-grapheme-preceding.js rename to test/intl402/Segmenter/prototype/segment/segment-grapheme-preceding.js index 0031c22d2d..78887b26f6 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-grapheme-preceding.js +++ b/test/intl402/Segmenter/prototype/segment/segment-grapheme-preceding.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "grapheme"}) for (const text of [ @@ -27,18 +32,18 @@ for (const text of [ let prev = text.length; let segments = []; iter.preceding(prev) - assertEquals(undefined, iter.breakType) - assertTrue(iter.position >= 0); - assertTrue(iter.position < prev); + assert.sameValue(undefined, iter.breakType) + assert(iter.position >= 0); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; while (!iter.preceding()) { - assertEquals(undefined, iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position < prev); + assert.sameValue(undefined, iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; } - assertEquals(text, segments.reverse().join("")); + assert.sameValue(text, segments.reverse().join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-grapheme.js b/test/intl402/Segmenter/prototype/segment/segment-grapheme.js similarity index 83% rename from implementation-contributed/v8/intl/segmenter/segment-grapheme.js rename to test/intl402/Segmenter/prototype/segment/segment-grapheme.js index 6b7e6eaf10..e10c03d4bd 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-grapheme.js +++ b/test/intl402/Segmenter/prototype/segment/segment-grapheme.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "grapheme"}) for (const text of [ @@ -24,6 +29,6 @@ for (const text of [ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean ]) { const iter = seg.segment(text); - assertEquals(undefined, iter.breakType); - assertEquals(0, iter.position); + assert.sameValue(undefined, iter.breakType); + assert.sameValue(0, iter.position); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-following-modes.js b/test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js similarity index 66% rename from implementation-contributed/v8/intl/segmenter/segment-line-following-modes.js rename to test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js index 75e90f3bf4..403468bacc 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line-following-modes.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line-following-modes.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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"]) { @@ -39,19 +44,19 @@ for (const locale of ["en", "fr", "ja", "zh", "ko"]) { } // In Japanese // Just test the break count in loose mode is greater than normal mode. -assertTrue(breakCounts["ja-loose"] > breakCounts["ja-normal"]); +assert(breakCounts["ja-loose"] > breakCounts["ja-normal"]); // and test the break count in normal mode is greater than strict mode. -assertTrue(breakCounts["ja-normal"] > breakCounts["ja-strict"]); +assert(breakCounts["ja-normal"] > breakCounts["ja-strict"]); // In Chinese // Just test the break count in loose mode is greater than normal mode. -assertTrue(breakCounts["zh-loose"] > breakCounts["zh-normal"]); +assert(breakCounts["zh-loose"] > breakCounts["zh-normal"]); // and test the break count in normal mode is greater than strict mode. -assertTrue(breakCounts["zh-normal"] > breakCounts["zh-strict"]); +assert(breakCounts["zh-normal"] > breakCounts["zh-strict"]); // In English, French and Korean -assertEquals(breakCounts["en-loose"], breakCounts["en-normal"]); -assertEquals(breakCounts["fr-loose"], breakCounts["fr-normal"]); -assertEquals(breakCounts["ko-loose"], breakCounts["ko-normal"]); +assert.sameValue(breakCounts["en-loose"], breakCounts["en-normal"]); +assert.sameValue(breakCounts["fr-loose"], breakCounts["fr-normal"]); +assert.sameValue(breakCounts["ko-loose"], breakCounts["ko-normal"]); // and test the break count in normal mode is greater than strict mode. -assertTrue(breakCounts["en-normal"] > breakCounts["en-strict"]); -assertTrue(breakCounts["fr-normal"] > breakCounts["fr-strict"]); -assertTrue(breakCounts["ko-normal"] > breakCounts["ko-strict"]); +assert(breakCounts["en-normal"] > breakCounts["en-strict"]); +assert(breakCounts["fr-normal"] > breakCounts["fr-strict"]); +assert(breakCounts["ko-normal"] > breakCounts["ko-strict"]); diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-following.js b/test/intl402/Segmenter/prototype/segment/segment-line-following.js similarity index 80% rename from implementation-contributed/v8/intl/segmenter/segment-line-following.js rename to test/intl402/Segmenter/prototype/segment/segment-line-following.js index 010f1cf7bb..16d5144add 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line-following.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line-following.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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 [ @@ -27,12 +32,12 @@ for (const text of [ let prev = 0; let segments = []; while (!iter.following()) { - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position > prev); + assert(["soft", "hard"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position > prev); segments.push(text.substring(prev, iter.position)); prev = iter.position; } - assertEquals(text, segments.join("")); + assert.sameValue(text, segments.join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-iterable.js b/test/intl402/Segmenter/prototype/segment/segment-line-iterable.js similarity index 78% rename from implementation-contributed/v8/intl/segmenter/segment-line-iterable.js rename to test/intl402/Segmenter/prototype/segment/segment-line-iterable.js index 0fb682c37e..88dd9349da 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line-iterable.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line-iterable.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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 [ @@ -29,17 +34,17 @@ for (const text of [ let iter = seg.segment(text); let prev = 0; for (const v of seg.segment(text)) { - assertTrue(["soft", "hard"].includes(v.breakType), v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + 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. assertFalse(iter.following()); - assertEquals(iter.breakType, v.breakType); - assertEquals(text.substring(prev, iter.position), v.segment); + assert.sameValue(iter.breakType, v.breakType); + assert.sameValue(text.substring(prev, iter.position), v.segment); prev = iter.position; } - assertTrue(iter.following()); - assertEquals(text, segments.join('')); + assert(iter.following()); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-next.js b/test/intl402/Segmenter/prototype/segment/segment-line-next.js similarity index 81% rename from implementation-contributed/v8/intl/segmenter/segment-line-next.js rename to test/intl402/Segmenter/prototype/segment/segment-line-next.js index ecfb7eca82..01cd79a61d 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line-next.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line-next.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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 [ @@ -27,10 +32,10 @@ for (const text of [ let segments = []; for (let result = iter.next(); !result.done; result = iter.next()) { const v = result.value; - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert(["soft", "hard"].includes(iter.breakType), iter.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); } - assertEquals(text, segments.join('')); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-preceding.js b/test/intl402/Segmenter/prototype/segment/segment-line-preceding.js similarity index 77% rename from implementation-contributed/v8/intl/segmenter/segment-line-preceding.js rename to test/intl402/Segmenter/prototype/segment/segment-line-preceding.js index 3491a21b9b..1819cb18f7 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line-preceding.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line-preceding.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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 [ @@ -27,18 +32,18 @@ for (const text of [ let prev = text.length; let segments = []; iter.preceding(prev) - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position < prev); + assert(["soft", "hard"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; while (!iter.preceding()) { - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position < prev); + assert(["soft", "hard"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; } - assertEquals(text, segments.reverse().join("")); + assert.sameValue(text, segments.reverse().join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-line.js b/test/intl402/Segmenter/prototype/segment/segment-line.js similarity index 83% rename from implementation-contributed/v8/intl/segmenter/segment-line.js rename to test/intl402/Segmenter/prototype/segment/segment-line.js index cbaa44356f..7ad7262eb3 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-line.js +++ b/test/intl402/Segmenter/prototype/segment/segment-line.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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 [ @@ -24,6 +29,6 @@ for (const text of [ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean ]) { const iter = seg.segment(text); - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertEquals(0, iter.position); + assert(["soft", "hard"].includes(iter.breakType), iter.breakType); + assert.sameValue(0, iter.position); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-sentence-following.js b/test/intl402/Segmenter/prototype/segment/segment-sentence-following.js similarity index 80% rename from implementation-contributed/v8/intl/segmenter/segment-sentence-following.js rename to test/intl402/Segmenter/prototype/segment/segment-sentence-following.js index 4acae8ba3c..426ffaa0a2 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-sentence-following.js +++ b/test/intl402/Segmenter/prototype/segment/segment-sentence-following.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "sentence"}) for (const text of [ @@ -27,12 +32,12 @@ for (const text of [ let prev = 0; let segments = []; while (!iter.following()) { - assertTrue(["sep", "term"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position > prev); + assert(["sep", "term"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position > prev); segments.push(text.substring(prev, iter.position)); prev = iter.position; } - assertEquals(text, segments.join("")); + assert.sameValue(text, segments.join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-sentence-iterable.js b/test/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js similarity index 78% rename from implementation-contributed/v8/intl/segmenter/segment-sentence-iterable.js rename to test/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js index 6bd3969c2b..b7596d3c9c 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-sentence-iterable.js +++ b/test/intl402/Segmenter/prototype/segment/segment-sentence-iterable.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "sentence"}) for (const text of [ @@ -29,17 +34,17 @@ for (const text of [ let iter = seg.segment(text); let prev = 0; for (const v of seg.segment(text)) { - assertTrue(["sep", "term"].includes(v.breakType), v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert(["sep", "term"].includes(v.breakType), v.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); // manually advance the iter. assertFalse(iter.following()); - assertEquals(iter.breakType, v.breakType); - assertEquals(text.substring(prev, iter.position), v.segment); + assert.sameValue(iter.breakType, v.breakType); + assert.sameValue(text.substring(prev, iter.position), v.segment); prev = iter.position; } - assertTrue(iter.following()); - assertEquals(text, segments.join('')); + assert(iter.following()); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-sentence-next.js b/test/intl402/Segmenter/prototype/segment/segment-sentence-next.js similarity index 81% rename from implementation-contributed/v8/intl/segmenter/segment-sentence-next.js rename to test/intl402/Segmenter/prototype/segment/segment-sentence-next.js index 071f00cfdf..41492252f8 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-sentence-next.js +++ b/test/intl402/Segmenter/prototype/segment/segment-sentence-next.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "sentence"}) for (const text of [ @@ -27,10 +32,10 @@ for (const text of [ let segments = []; for (let result = iter.next(); !result.done; result = iter.next()) { const v = result.value; - assertTrue(["sep", "term"].includes(iter.breakType), iter.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert(["sep", "term"].includes(iter.breakType), iter.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); } - assertEquals(text, segments.join('')); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-sentence-preceding.js b/test/intl402/Segmenter/prototype/segment/segment-sentence-preceding.js similarity index 77% rename from implementation-contributed/v8/intl/segmenter/segment-sentence-preceding.js rename to test/intl402/Segmenter/prototype/segment/segment-sentence-preceding.js index 291b315312..cdb41402cf 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-sentence-preceding.js +++ b/test/intl402/Segmenter/prototype/segment/segment-sentence-preceding.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "sentence"}) for (const text of [ @@ -27,18 +32,18 @@ for (const text of [ let prev = text.length; let segments = []; iter.preceding(prev); - assertTrue(["sep", "term"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position < prev); + assert(["sep", "term"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; while (!iter.preceding()) { - assertTrue(["sep", "term"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position < prev); + assert(["sep", "term"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; } - assertEquals(text, segments.reverse().join("")); + assert.sameValue(text, segments.reverse().join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-sentence.js b/test/intl402/Segmenter/prototype/segment/segment-sentence.js similarity index 83% rename from implementation-contributed/v8/intl/segmenter/segment-sentence.js rename to test/intl402/Segmenter/prototype/segment/segment-sentence.js index b258d61998..3ba03f5746 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-sentence.js +++ b/test/intl402/Segmenter/prototype/segment/segment-sentence.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "sentence"}) for (const text of [ @@ -24,6 +29,6 @@ for (const text of [ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean ]) { const iter = seg.segment(text); - assertTrue(["sep", "term"].includes(iter.breakType), iter.breakType); - assertEquals(0, iter.position); + assert(["sep", "term"].includes(iter.breakType), iter.breakType); + assert.sameValue(0, iter.position); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-word-following.js b/test/intl402/Segmenter/prototype/segment/segment-word-following.js similarity index 80% rename from implementation-contributed/v8/intl/segmenter/segment-word-following.js rename to test/intl402/Segmenter/prototype/segment/segment-word-following.js index 5f2872e581..6609acd05c 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-word-following.js +++ b/test/intl402/Segmenter/prototype/segment/segment-word-following.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "word"}) for (const text of [ @@ -27,12 +32,12 @@ for (const text of [ let prev = 0; let segments = []; while (!iter.following()) { - assertTrue(["word", "none"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position > prev); + assert(["word", "none"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position > prev); segments.push(text.substring(prev, iter.position)); prev = iter.position; } - assertEquals(text, segments.join("")); + assert.sameValue(text, segments.join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-word-iterable.js b/test/intl402/Segmenter/prototype/segment/segment-word-iterable.js similarity index 78% rename from implementation-contributed/v8/intl/segmenter/segment-word-iterable.js rename to test/intl402/Segmenter/prototype/segment/segment-word-iterable.js index 120f46842d..d28f0489a7 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-word-iterable.js +++ b/test/intl402/Segmenter/prototype/segment/segment-word-iterable.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "word"}) for (const text of [ @@ -29,17 +34,17 @@ for (const text of [ let iter = seg.segment(text); let prev = 0; for (const v of seg.segment(text)) { - assertTrue(["word", "none"].includes(v.breakType), v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert(["word", "none"].includes(v.breakType), v.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); // manually advance the iter. assertFalse(iter.following()); - assertEquals(iter.breakType, v.breakType); - assertEquals(text.substring(prev, iter.position), v.segment); + assert.sameValue(iter.breakType, v.breakType); + assert.sameValue(text.substring(prev, iter.position), v.segment); prev = iter.position; } - assertTrue(iter.following()); - assertEquals(text, segments.join('')); + assert(iter.following()); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-word-next.js b/test/intl402/Segmenter/prototype/segment/segment-word-next.js similarity index 81% rename from implementation-contributed/v8/intl/segmenter/segment-word-next.js rename to test/intl402/Segmenter/prototype/segment/segment-word-next.js index a88e9366ef..27bed47278 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-word-next.js +++ b/test/intl402/Segmenter/prototype/segment/segment-word-next.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "word"}) for (const text of [ @@ -27,10 +32,10 @@ for (const text of [ let segments = []; for (let result = iter.next(); !result.done; result = iter.next()) { const v = result.value; - assertTrue(["word", "none"].includes(iter.breakType), iter.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); + assert(["word", "none"].includes(iter.breakType), iter.breakType); + assert.sameValue("string", typeof v.segment); + assert(v.segment.length > 0); segments.push(v.segment); } - assertEquals(text, segments.join('')); + assert.sameValue(text, segments.join('')); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-word-preceding.js b/test/intl402/Segmenter/prototype/segment/segment-word-preceding.js similarity index 77% rename from implementation-contributed/v8/intl/segmenter/segment-word-preceding.js rename to test/intl402/Segmenter/prototype/segment/segment-word-preceding.js index fee750f345..ddff70c710 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-word-preceding.js +++ b/test/intl402/Segmenter/prototype/segment/segment-word-preceding.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "word"}) for (const text of [ @@ -27,18 +32,18 @@ for (const text of [ let prev = text.length; let segments = []; iter.preceding(prev); - assertTrue(["word", "none"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position < prev); + assert(["word", "none"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; while (!iter.preceding()) { - assertTrue(["word", "none"].includes(iter.breakType), iter.breakType); - assertTrue(iter.position >= 0); - assertTrue(iter.position <= text.length); - assertTrue(iter.position < prev); + assert(["word", "none"].includes(iter.breakType), iter.breakType); + assert(iter.position >= 0); + assert(iter.position <= text.length); + assert(iter.position < prev); segments.push(text.substring(iter.position, prev)); prev = iter.position; } - assertEquals(text, segments.reverse().join("")); + assert.sameValue(text, segments.reverse().join("")); } diff --git a/implementation-contributed/v8/intl/segmenter/segment-word.js b/test/intl402/Segmenter/prototype/segment/segment-word.js similarity index 83% rename from implementation-contributed/v8/intl/segmenter/segment-word.js rename to test/intl402/Segmenter/prototype/segment/segment-word.js index 4c74fbee3c..935eadb38e 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-word.js +++ b/test/intl402/Segmenter/prototype/segment/segment-word.js @@ -1,8 +1,13 @@ // 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. +// This code is governed by the BSD license found in the LICENSE file. -// Flags: --harmony-intl-segmenter +/*--- +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: "word"}) for (const text of [ @@ -24,6 +29,6 @@ for (const text of [ "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean ]) { const iter = seg.segment(text); - assertTrue(["word", "none"].includes(iter.breakType), iter.breakType); - assertEquals(0, iter.position); + assert(["word", "none"].includes(iter.breakType), iter.breakType); + assert.sameValue(0, iter.position); } -- GitLab