js/src/tests/ecma/String/15.5.5.1.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:          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