Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: test/mjsunit/mirror-string.js

Issue 113399: Use JSON.stringify to serialize debugger messages (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/mirror-script.js ('k') | test/mjsunit/mirror-undefined.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « test/mjsunit/mirror-script.js ('k') | test/mjsunit/mirror-undefined.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698