js/src/tests/ecma/String/15.5.3.2-2.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.3.2-2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     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.3.2-2.js
    1.12 +   ECMA Section:       15.5.3.2  String.fromCharCode( char0, char1, ... )
    1.13 +   Description:        Return a string value containing as many characters
    1.14 +   as the number of arguments.  Each argument specifies
    1.15 +   one character of the resulting string, with the first
    1.16 +   argument specifying the first character, and so on,
    1.17 +   from left to right.  An argument is converted to a
    1.18 +   character by applying the operation ToUint16_t and
    1.19 +   regarding the resulting 16bit integeras the Unicode
    1.20 +   encoding of a character.  If no arguments are supplied,
    1.21 +   the result is the empty string.
    1.22 +
    1.23 +   This tests String.fromCharCode with multiple arguments.
    1.24 +
    1.25 +   Author:             christine@netscape.com
    1.26 +   Date:               2 october 1997
    1.27 +*/
    1.28 +
    1.29 +var SECTION = "15.5.3.2-2";
    1.30 +var VERSION = "ECMA_1";
    1.31 +startTest();
    1.32 +var TITLE   = "String.fromCharCode()";
    1.33 +
    1.34 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.35 +
    1.36 +new TestCase( SECTION,
    1.37 +	      "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING",
    1.38 +	      " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
    1.39 +	      eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" ));
    1.40 +
    1.41 +new TestCase( SECTION,
    1.42 +	      "MYSTRING.length",
    1.43 +	      0x007f - 0x0020,
    1.44 +	      MYSTRING.length );
    1.45 +
    1.46 +test();

mercurial