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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6eea9d811cd6
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/. */
5
6
7 /**
8 File Name: 15.5.5.1
9 ECMA Section: String.length
10 Description:
11
12 The number of characters in the String value represented by this String
13 object.
14
15 Once a String object is created, this property is unchanging. It has the
16 attributes { DontEnum, DontDelete, ReadOnly }.
17
18 Author: christine@netscape.com
19 Date: 12 november 1997
20 */
21
22 var SECTION = "15.5.5.1";
23 var VERSION = "ECMA_1";
24 startTest();
25 var TITLE = "String.length";
26
27 writeHeaderToLog( SECTION + " "+ TITLE);
28
29 new TestCase( SECTION,
30 "var s = new String(); s.length",
31 0,
32 eval("var s = new String(); s.length") );
33
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") );
38
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") );
43
44 new TestCase( SECTION,
45 "var s = new String(); delete s.length",
46 false,
47 eval("var s = new String(); delete s.length") );
48
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") );
53
54 test();

mercurial