js/src/tests/ecma/String/15.5.4.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/String/15.5.4.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     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.4.js
    1.12 +   ECMA Section:       15.5.4 Properties of the String prototype object
    1.13 +
    1.14 +   Description:
    1.15 +   Author:             christine@netscape.com
    1.16 +   Date:               28 october 1997
    1.17 +
    1.18 +*/
    1.19 +var SECTION = "15.5.4";
    1.20 +var VERSION = "ECMA_1";
    1.21 +startTest();
    1.22 +var TITLE   = "Properties of the String Prototype objecta";
    1.23 +
    1.24 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.25 +
    1.26 +
    1.27 +new TestCase( SECTION,
    1.28 +	      "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()",
    1.29 +	      "[object String]",
    1.30 +	      eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") );
    1.31 +
    1.32 +delete String.prototype.getClass;
    1.33 +
    1.34 +new TestCase( SECTION,
    1.35 +              "typeof String.prototype",  
    1.36 +              "object",  
    1.37 +              typeof String.prototype );
    1.38 +
    1.39 +new TestCase( SECTION,
    1.40 +              "String.prototype.valueOf()",
    1.41 +              "",       
    1.42 +              String.prototype.valueOf() );
    1.43 +
    1.44 +new TestCase( SECTION,
    1.45 +              "String.prototype +''",      
    1.46 +              "",       
    1.47 +              String.prototype + '' );
    1.48 +
    1.49 +new TestCase( SECTION,
    1.50 +              "String.prototype.length",   
    1.51 +              0,        
    1.52 +              String.prototype.length );
    1.53 +
    1.54 +var prop;
    1.55 +var value;
    1.56 +
    1.57 +value = '';
    1.58 +for (prop in "")
    1.59 +{
    1.60 +  value += prop;
    1.61 +}
    1.62 +new TestCase( SECTION,
    1.63 +              'String "" has no enumerable properties',
    1.64 +              '',
    1.65 +              value );
    1.66 +
    1.67 +value = '';
    1.68 +for (prop in String.prototype)
    1.69 +{
    1.70 +  value += prop;
    1.71 +}
    1.72 +new TestCase( SECTION,
    1.73 +              'String.prototype has no enumerable properties',
    1.74 +              '',
    1.75 +              value );
    1.76 +
    1.77 +test();

mercurial