js/src/tests/ecma/String/15.5.5.1.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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:          15.5.5.1
     9    ECMA Section:       String.length
    10    Description:
    12    The number of characters in the String value represented by this String
    13    object.
    15    Once a String object is created, this property is unchanging. It has the
    16    attributes { DontEnum, DontDelete, ReadOnly }.
    18    Author:             christine@netscape.com
    19    Date:               12 november 1997
    20 */
    22 var SECTION = "15.5.5.1";
    23 var VERSION = "ECMA_1";
    24 startTest();
    25 var TITLE   = "String.length";
    27 writeHeaderToLog( SECTION + " "+ TITLE);
    29 new TestCase(   SECTION,
    30 		"var s = new String(); s.length",
    31 		0,
    32 		eval("var s = new String(); s.length") );
    34 new TestCase(   SECTION,
    35 		"var s = new String(); s.length = 10; s.length",
    36 		0,
    37 		eval("var s = new String(); s.length = 10; s.length") );
    39 new TestCase(   SECTION,
    40 		"var s = new String(); var props = ''; for ( var p in s ) {  props += p; };  props",
    41 		"",
    42 		eval("var s = new String(); var props = ''; for ( var p in s ) {  props += p; };  props") );
    44 new TestCase(   SECTION,
    45 		"var s = new String(); delete s.length",
    46 		false,
    47 		eval("var s = new String(); delete s.length") );
    49 new TestCase(   SECTION,
    50 		"var s = new String('hello'); delete s.length; s.length",
    51 		5,
    52 		eval("var s = new String('hello'); delete s.length; s.length") );
    54 test();

mercurial