js/src/tests/ecma_2/Exceptions/boolean-001.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          boolean-001.js
     9    Description:        Corresponds to ecma/Boolean/15.6.4.2-4-n.js
    11    The toString function is not generic; it generates
    12    a runtime error if its this value is not a Boolean
    13    object.  Therefore it cannot be transferred to other
    14    kinds of objects for use as a method.
    16    Author:             christine@netscape.com
    17    Date:               june 27, 1997
    18 */
    19 var SECTION = "boolean-001.js";
    20 var VERSION = "JS1_4";
    21 var TITLE   = "Boolean.prototype.toString()";
    22 startTest();
    23 writeHeaderToLog( SECTION +" "+ TITLE );
    25 var exception = "No exception thrown";
    26 var result = "Failed";
    28 var TO_STRING = Boolean.prototype.toString;
    30 try {
    31   var s = new String("Not a Boolean");
    32   s.toString = TO_STRING;
    33   s.toString();
    34 } catch ( e ) {
    35   result = "Passed!";
    36   exception = e.toString();
    37 }
    39 new TestCase(
    40   SECTION,
    41   "Assigning Boolean.prototype.toString to a String object "+
    42   "(threw " +exception +")",
    43   "Passed!",
    44   result );
    46 test();

mercurial