]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma/String/15.5.5.1.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
24 ECMA Section: String.length
27 The number of characters in the String value represented by this String
30 Once a String object is created, this property is unchanging. It has the
31 attributes { DontEnum, DontDelete, ReadOnly }.
33 Author: christine@netscape.com
34 Date: 12 november 1997
37 var SECTION
= "15.5.5.1";
38 var VERSION
= "ECMA_1";
40 var TITLE
= "String.length";
42 writeHeaderToLog( SECTION
+ " "+ TITLE
);
44 var testcases
= getTestCases();
47 function getTestCases() {
48 var array
= new Array();
51 array
[item
++] = new TestCase( SECTION
,
52 "var s = new String(); s.length",
54 eval("var s = new String(); s.length") );
56 array
[item
++] = new TestCase( SECTION
,
57 "var s = new String(); s.length = 10; s.length",
59 eval("var s = new String(); s.length = 10; s.length") );
61 array
[item
++] = new TestCase( SECTION
,
62 "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props",
64 eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") );
66 array
[item
++] = new TestCase( SECTION
,
67 "var s = new String(); delete s.length",
69 eval("var s = new String(); delete s.length") );
71 array
[item
++] = new TestCase( SECTION
,
72 "var s = new String('hello'); delete s.length; s.length",
74 eval("var s = new String('hello'); delete s.length; s.length") );
79 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
80 testcases
[tc
].passed
= writeTestCaseResult(
83 testcases
[tc
].description
+" = "+
84 testcases
[tc
].actual
);
86 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";