js/src/tests/test262/intl402/ch10/10.1/10.1.1_1.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright 2012 Mozilla Corporation. All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * @description Tests that an object can't be re-initialized as a Collator.
     6  * @author Norbert Lindenberg
     7  */
     9 $INCLUDE("testIntl.js");
    11 testWithIntlConstructors(function (Constructor) {
    12     var obj, error;
    14     // variant 1: use constructor in a "new" expression
    15     obj = new Constructor();
    16     try {
    17         Intl.Collator.call(obj);
    18     } catch (e) {
    19         error = e;
    20     }
    21     if (error === undefined) {
    22         $ERROR("Re-initializing object created with \"new\" as Collator was not rejected.");
    23     } else if (error.name !== "TypeError") {
    24         $ERROR("Re-initializing object created with \"new\" as Collator was rejected with wrong error " + error.name + ".");
    25     }
    27     // variant 2: use constructor as a function
    28     obj = Constructor.call({});
    29     error = undefined;
    30     try {
    31         Intl.Collator.call(obj);
    32     } catch (e) {
    33         error = e;
    34     }
    35     if (error === undefined) {
    36         $ERROR("Re-initializing object created with constructor as function as Collator was not rejected.");
    37     } else if (error.name !== "TypeError") {
    38         $ERROR("Re-initializing object created with constructor as function as Collator was rejected with wrong error " + error.name + ".");
    39     }
    41     return true;
    42 });

mercurial