| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // Flags: --expose-debug-as debug | 28 // Flags: --expose-debug-as debug |
| 29 // Test the mirror object for string values | 29 // Test the mirror object for string values |
| 30 | 30 |
| 31 const kMaxProtocolStringLength = 80; // Constant from mirror-delay.js | 31 const kMaxProtocolStringLength = 80; // Constant from mirror-delay.js |
| 32 | 32 |
| 33 function testStringMirror(s) { | 33 function testStringMirror(s) { |
| 34 // Create mirror and JSON representation. | 34 // Create mirror and JSON representation. |
| 35 var mirror = debug.MakeMirror(s); | 35 var mirror = debug.MakeMirror(s); |
| 36 var serializer = debug.MakeMirrorSerializer(); | 36 var serializer = debug.MakeMirrorSerializer(); |
| 37 var json = serializer.serializeValue(mirror); | 37 var json = JSON.stringify(serializer.serializeValue(mirror)); |
| 38 | 38 |
| 39 // Check the mirror hierachy. | 39 // Check the mirror hierachy. |
| 40 assertTrue(mirror instanceof debug.Mirror); | 40 assertTrue(mirror instanceof debug.Mirror); |
| 41 assertTrue(mirror instanceof debug.ValueMirror); | 41 assertTrue(mirror instanceof debug.ValueMirror); |
| 42 assertTrue(mirror instanceof debug.StringMirror); | 42 assertTrue(mirror instanceof debug.StringMirror); |
| 43 | 43 |
| 44 // Check the mirror properties. | 44 // Check the mirror properties. |
| 45 assertTrue(mirror.isString()); | 45 assertTrue(mirror.isString()); |
| 46 assertEquals('string', mirror.type()); | 46 assertEquals('string', mirror.type()); |
| 47 assertTrue(mirror.isPrimitive()); | 47 assertTrue(mirror.isPrimitive()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 testStringMirror('\b\t\n\f\r'); | 80 testStringMirror('\b\t\n\f\r'); |
| 81 testStringMirror('\u0001\u0002\u001E\u001F'); | 81 testStringMirror('\u0001\u0002\u001E\u001F'); |
| 82 testStringMirror('"a":1,"b":2'); | 82 testStringMirror('"a":1,"b":2'); |
| 83 | 83 |
| 84 var s = "1234567890" | 84 var s = "1234567890" |
| 85 s = s + s + s + s + s + s + s + s; | 85 s = s + s + s + s + s + s + s + s; |
| 86 assertEquals(kMaxProtocolStringLength, s.length); | 86 assertEquals(kMaxProtocolStringLength, s.length); |
| 87 testStringMirror(s); | 87 testStringMirror(s); |
| 88 s = s + 'X'; | 88 s = s + 'X'; |
| 89 testStringMirror(s); | 89 testStringMirror(s); |
| OLD | NEW |