| Index: test/intl/overrides/string.js
|
| diff --git a/test/mjsunit/regress/regress-crbug-222893.js b/test/intl/overrides/string.js
|
| similarity index 59%
|
| copy from test/mjsunit/regress/regress-crbug-222893.js
|
| copy to test/intl/overrides/string.js
|
| index d5baa7b2579b9330231dc7e3329b42aa1a579a60..9e9da4da1d152c731eb5b7a01d75da4dd72b1730 100644
|
| --- a/test/mjsunit/regress/regress-crbug-222893.js
|
| +++ b/test/intl/overrides/string.js
|
| @@ -25,40 +25,45 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --expose-debug-as debug
|
| +// Tests String.prototype.localeCompare method override.
|
|
|
| -Debug = debug.Debug
|
| +var testData = {
|
| + 'en': ['blood', 'bull', 'ascend', 'zed', 'down'],
|
| + 'sr': ['новине', 'ограда', 'жирафа', 'Никола', 'Андрија', 'Стара Планина',
|
| + 'џак', 'алав', 'ћук', 'чука'],
|
| + 'de': ['März', 'Fuße', 'FUSSE', 'Fluße', 'Flusse', 'flusse', 'fluße',
|
| + 'flüße', 'flüsse']
|
| +};
|
|
|
| -var error = null;
|
| -var array = ["a", "b", "c"];
|
|
|
| -function listener(event, exec_state, event_data, data) {
|
| - try {
|
| - if (event == Debug.DebugEvent.Break) {
|
| - assertArrayEquals(array,
|
| - exec_state.frame(0).evaluate('arguments').value());
|
| - }
|
| - } catch (e) {
|
| - error = e;
|
| +function testArrays(locale) {
|
| + var data;
|
| + if (locale === undefined) {
|
| + data = testData['en'];
|
| + locale = [];
|
| + } else {
|
| + data = testData[locale];
|
| }
|
| -};
|
|
|
| -Debug.setListener(listener);
|
| + var collator = new Intl.Collator(locale, options);
|
| + var collatorResult = data.sort(collator.compare);
|
| + var localeCompareResult = data.sort(function(a, b) {
|
| + return a.localeCompare(b, locale, options)
|
| + });
|
| + assertEquals(collatorResult, localeCompareResult);
|
| +}
|
| +
|
|
|
| +// Defaults
|
| +var options = undefined;
|
| +testArrays();
|
|
|
| -function f(a, b) {
|
| - arguments;
|
| - debugger; // Arguments object is already materialized.
|
| -}
|
|
|
| -f.apply(this, array);
|
| -f("a", "b", "c");
|
| -assertNull(error);
|
| +// Specify locale, keep default options.
|
| +options = undefined;
|
| +Object.keys(testData).forEach(testArrays);
|
|
|
| -function g(a, b) {
|
| - debugger; // Arguments object is not yet materialized.
|
| -}
|
| -g.apply(this, array);
|
| -g("a", "b", "c");
|
| -assertNull(error);
|
|
|
| +// Specify locale and options.
|
| +options = {caseFirst: 'upper'};
|
| +Object.keys(testData).forEach(testArrays);
|
|
|