| 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 | gTestfile = '15.5.3.2-2.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 15.5.3.2-2.js |
| 10 | ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) |
| 11 | Description: Return a string value containing as many characters |
| 12 | as the number of arguments. Each argument specifies |
| 13 | one character of the resulting string, with the first |
| 14 | argument specifying the first character, and so on, |
| 15 | from left to right. An argument is converted to a |
| 16 | character by applying the operation ToUint16 and |
| 17 | regarding the resulting 16bit integeras the Unicode |
| 18 | encoding of a character. If no arguments are supplied, |
| 19 | the result is the empty string. |
| 20 | |
| 21 | This tests String.fromCharCode with multiple arguments. |
| 22 | |
| 23 | Author: [email protected] |
| 24 | Date: 2 october 1997 |
| 25 | */ |
| 26 | |
| 27 | var SECTION = "15.5.3.2-2"; |
| 28 | var VERSION = "ECMA_1"; |
| 29 | startTest(); |
| 30 | var TITLE = "String.fromCharCode()"; |
| 31 | |
| 32 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 33 | |
| 34 | new TestCase( SECTION, |
| 35 | "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING", |
| 36 | " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", |
| 37 | eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" )); |
| 38 | |
| 39 | new TestCase( SECTION, |
| 40 | "MYSTRING.length", |
| 41 | 0x007f - 0x0020, |
| 42 | MYSTRING.length ); |
| 43 | |
| 44 | test(); |