OLD | NEW |
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 2. Call ToInteger(pos) | 53 2. Call ToInteger(pos) |
54 3. Compute the number of characters in result(1). | 54 3. Compute the number of characters in result(1). |
55 4. If Result(2) is less than 0 or is not less than | 55 4. If Result(2) is less than 0 or is not less than |
56 Result(3), return NaN. | 56 Result(3), return NaN. |
57 5. Return a value of Number type, of positive sign, whose | 57 5. Return a value of Number type, of positive sign, whose |
58 magnitude is the Unicode encoding of one character | 58 magnitude is the Unicode encoding of one character |
59 from result 1, namely the characer at position Result | 59 from result 1, namely the characer at position Result |
60 (2), where the first character in Result(1) is | 60 (2), where the first character in Result(1) is |
61 considered to be at position 0. | 61 considered to be at position 0. |
62 | 62 |
63 Note that the charCodeAt funciton is intentionally | 63 Note that the charCodeAt function is intentionally |
64 generic; it does not require that its this value be a | 64 generic; it does not require that its this value be a |
65 String object. Therefore it can be transferred to other | 65 String object. Therefore it can be transferred to other |
66 kinds of objects for use as a method. | 66 kinds of objects for use as a method. |
67 | 67 |
68 Author: christine@netscape.com | 68 Author: christine@netscape.com |
69 Date: 2 october 1997 | 69 Date: 2 october 1997 |
70 */ | 70 */ |
71 var SECTION = "15.5.4.5-1"; | 71 var SECTION = "15.5.4.5-1"; |
72 var VERSION = "ECMA_1"; | 72 var VERSION = "ECMA_1"; |
73 startTest(); | 73 startTest(); |
74 var TITLE = "String.prototype.charCodeAt"; | 74 var TITLE = "String.prototype.charCodeAt"; |
75 | 75 |
76 writeHeaderToLog( SECTION + " "+ TITLE); | 76 writeHeaderToLog( SECTION + " "+ TITLE); |
77 | 77 |
78 var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); | 78 var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); |
79 | 79 |
80 for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) { | 80 for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) { |
81 new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCod
eAt( j ) ); | 81 new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCod
eAt( j ) ); |
82 } | 82 } |
83 | 83 |
84 new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.char
CodeAt( i ) ); | 84 new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.char
CodeAt( i ) ); |
85 | 85 |
86 | 86 |
87 test(); | 87 test(); |
OLD | NEW |