| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 assertEquals("t", s().charAt(void 0)); | 41 assertEquals("t", s().charAt(void 0)); |
| 42 assertEquals("t", s().charAt(false)); | 42 assertEquals("t", s().charAt(false)); |
| 43 assertEquals("e", s().charAt(true)); | 43 assertEquals("e", s().charAt(true)); |
| 44 assertEquals("", s().charAt(-1)); | 44 assertEquals("", s().charAt(-1)); |
| 45 assertEquals("", s().charAt(len)); | 45 assertEquals("", s().charAt(len)); |
| 46 assertEquals("", s().charAt(slowIndexOutOfRange)); | 46 assertEquals("", s().charAt(slowIndexOutOfRange)); |
| 47 assertEquals("", s().charAt(1/0)); | 47 assertEquals("", s().charAt(1/0)); |
| 48 assertEquals("", s().charAt(-1/0)); | 48 assertEquals("", s().charAt(-1/0)); |
| 49 assertEquals("t", s().charAt(0)); | 49 assertEquals("t", s().charAt(0)); |
| 50 assertEquals("t", s().charAt(-0.0)); | 50 assertEquals("t", s().charAt(-0.0)); |
| 51 assertEquals("t", s().charAt(-0.1)); |
| 51 assertEquals("t", s().charAt(0.4)); | 52 assertEquals("t", s().charAt(0.4)); |
| 52 assertEquals("e", s().charAt(slowIndex1)); | 53 assertEquals("e", s().charAt(slowIndex1)); |
| 53 assertEquals("s", s().charAt(slowIndex2)); | 54 assertEquals("s", s().charAt(slowIndex2)); |
| 54 assertEquals("t", s().charAt(3)); | 55 assertEquals("t", s().charAt(3)); |
| 55 assertEquals("t", s().charAt(3.4)); | 56 assertEquals("t", s().charAt(3.4)); |
| 56 assertEquals("t", s().charAt(NaN)); | 57 assertEquals("t", s().charAt(NaN)); |
| 57 | 58 |
| 58 assertEquals(116, s().charCodeAt()); | 59 assertEquals(116, s().charCodeAt()); |
| 59 assertEquals(116, s().charCodeAt("string")); | 60 assertEquals(116, s().charCodeAt("string")); |
| 60 assertEquals(116, s().charCodeAt(null)); | 61 assertEquals(116, s().charCodeAt(null)); |
| 61 assertEquals(116, s().charCodeAt(void 0)); | 62 assertEquals(116, s().charCodeAt(void 0)); |
| 62 assertEquals(116, s().charCodeAt(false)); | 63 assertEquals(116, s().charCodeAt(false)); |
| 63 assertEquals(101, s().charCodeAt(true)); | 64 assertEquals(101, s().charCodeAt(true)); |
| 64 assertEquals(116, s().charCodeAt(0)); | 65 assertEquals(116, s().charCodeAt(0)); |
| 65 assertEquals(116, s().charCodeAt(-0.0)); | 66 assertEquals(116, s().charCodeAt(-0.0)); |
| 67 assertEquals(116, s().charCodeAt(-0.1)); |
| 66 assertEquals(116, s().charCodeAt(0.4)); | 68 assertEquals(116, s().charCodeAt(0.4)); |
| 67 assertEquals(101, s().charCodeAt(slowIndex1)); | 69 assertEquals(101, s().charCodeAt(slowIndex1)); |
| 68 assertEquals(115, s().charCodeAt(slowIndex2)); | 70 assertEquals(115, s().charCodeAt(slowIndex2)); |
| 69 assertEquals(116, s().charCodeAt(3)); | 71 assertEquals(116, s().charCodeAt(3)); |
| 70 assertEquals(116, s().charCodeAt(3.4)); | 72 assertEquals(116, s().charCodeAt(3.4)); |
| 71 assertEquals(116, s().charCodeAt(NaN)); | 73 assertEquals(116, s().charCodeAt(NaN)); |
| 72 assertTrue(isNaN(s().charCodeAt(-1))); | 74 assertTrue(isNaN(s().charCodeAt(-1))); |
| 73 assertTrue(isNaN(s().charCodeAt(len))); | 75 assertTrue(isNaN(s().charCodeAt(len))); |
| 74 assertTrue(isNaN(s().charCodeAt(slowIndexOutOfRange))); | 76 assertTrue(isNaN(s().charCodeAt(slowIndexOutOfRange))); |
| 75 assertTrue(isNaN(s().charCodeAt(1/0))); | 77 assertTrue(isNaN(s().charCodeAt(1/0))); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 oldResult = result; | 246 oldResult = result; |
| 245 String.prototype.charCodeAt = function() { return 42; }; | 247 String.prototype.charCodeAt = function() { return 42; }; |
| 246 } | 248 } |
| 247 result = s.charCodeAt(1); | 249 result = s.charCodeAt(1); |
| 248 } | 250 } |
| 249 assertEquals(42, result); | 251 assertEquals(42, result); |
| 250 assertEquals(101, oldResult); | 252 assertEquals(101, oldResult); |
| 251 delete String.prototype.charCodeAt; // Restore the default. | 253 delete String.prototype.charCodeAt; // Restore the default. |
| 252 } | 254 } |
| 253 testPrototypeChange_charCodeAt(); | 255 testPrototypeChange_charCodeAt(); |
| OLD | NEW |