1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/String/15.5.5.1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: 15.5.5.1 1.12 + ECMA Section: String.length 1.13 + Description: 1.14 + 1.15 + The number of characters in the String value represented by this String 1.16 + object. 1.17 + 1.18 + Once a String object is created, this property is unchanging. It has the 1.19 + attributes { DontEnum, DontDelete, ReadOnly }. 1.20 + 1.21 + Author: christine@netscape.com 1.22 + Date: 12 november 1997 1.23 +*/ 1.24 + 1.25 +var SECTION = "15.5.5.1"; 1.26 +var VERSION = "ECMA_1"; 1.27 +startTest(); 1.28 +var TITLE = "String.length"; 1.29 + 1.30 +writeHeaderToLog( SECTION + " "+ TITLE); 1.31 + 1.32 +new TestCase( SECTION, 1.33 + "var s = new String(); s.length", 1.34 + 0, 1.35 + eval("var s = new String(); s.length") ); 1.36 + 1.37 +new TestCase( SECTION, 1.38 + "var s = new String(); s.length = 10; s.length", 1.39 + 0, 1.40 + eval("var s = new String(); s.length = 10; s.length") ); 1.41 + 1.42 +new TestCase( SECTION, 1.43 + "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props", 1.44 + "", 1.45 + eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") ); 1.46 + 1.47 +new TestCase( SECTION, 1.48 + "var s = new String(); delete s.length", 1.49 + false, 1.50 + eval("var s = new String(); delete s.length") ); 1.51 + 1.52 +new TestCase( SECTION, 1.53 + "var s = new String('hello'); delete s.length; s.length", 1.54 + 5, 1.55 + eval("var s = new String('hello'); delete s.length; s.length") ); 1.56 + 1.57 +test();