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

Side by Side Diff: test/mjsunit/debug-evaluate.js

Issue 647022: Add maxStrinLength argument to debugger requests (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 | « src/mirror-delay.js ('k') | no next file » | 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 testRequest(dcp, '{"expression":"({\\"a\\":1,\\"b\\":2}).b+2"}', true, 4); 80 testRequest(dcp, '{"expression":"({\\"a\\":1,\\"b\\":2}).b+2"}', true, 4);
81 81
82 // Test evaluation of a in the stack frames and the global context. 82 // Test evaluation of a in the stack frames and the global context.
83 testRequest(dcp, '{"expression":"a"}', true, 3); 83 testRequest(dcp, '{"expression":"a"}', true, 3);
84 testRequest(dcp, '{"expression":"a","frame":0}', true, 3); 84 testRequest(dcp, '{"expression":"a","frame":0}', true, 3);
85 testRequest(dcp, '{"expression":"a","frame":1}', true, 2); 85 testRequest(dcp, '{"expression":"a","frame":1}', true, 2);
86 testRequest(dcp, '{"expression":"a","frame":2}', true, 1); 86 testRequest(dcp, '{"expression":"a","frame":2}', true, 1);
87 testRequest(dcp, '{"expression":"a","global":true}', true, 1); 87 testRequest(dcp, '{"expression":"a","global":true}', true, 1);
88 testRequest(dcp, '{"expression":"this.a","global":true}', true, 1); 88 testRequest(dcp, '{"expression":"this.a","global":true}', true, 1);
89 89
90 // Test that the whole string text is returned if maxStringLength
91 // parameter is passed.
92 testRequest(
93 dcp,
94 '{"expression":"this.longString","global":true,maxStringLength:-1}',
95 true,
96 longString);
97 testRequest(
98 dcp,
99 '{"expression":"this.longString","global":true,maxStringLength:' +
100 longString.length + '}',
101 true,
102 longString);
103 var truncatedStringSuffix = '... (length: ' + longString.length + ')';
104 testRequest(
105 dcp,
106 '{"expression":"this.longString","global":true,maxStringLength:0}',
107 true,
108 truncatedStringSuffix);
109 testRequest(
110 dcp,
111 '{"expression":"this.longString","global":true,maxStringLength:1}',
112 true,
113 longString.charAt(0) + truncatedStringSuffix);
114 // Test that by default string is truncated to first 80 chars.
115 testRequest(
116 dcp,
117 '{"expression":"this.longString","global":true}',
118 true,
119 longString.substring(0, 80) + truncatedStringSuffix);
120
90 // Indicate that all was processed. 121 // Indicate that all was processed.
91 listenerComplete = true; 122 listenerComplete = true;
92 } 123 }
93 } catch (e) { 124 } catch (e) {
94 exception = e 125 exception = e
95 }; 126 };
96 }; 127 };
97 128
98 // Add the debug event listener. 129 // Add the debug event listener.
99 Debug.setListener(listener); 130 Debug.setListener(listener);
100 131
101 function f() { 132 function f() {
102 var a = 3; 133 var a = 3;
103 }; 134 };
104 135
105 function g() { 136 function g() {
106 var a = 2; 137 var a = 2;
107 f(); 138 f();
108 }; 139 };
109 140
110 a = 1; 141 a = 1;
111 142
143 // String which is longer than 80 chars.
144 var longString = "1234567890_";
145 for (var i = 0; i < 4; i++) {
146 longString += longString;
147 }
148
112 // Set a break point at return in f and invoke g to hit the breakpoint. 149 // Set a break point at return in f and invoke g to hit the breakpoint.
113 Debug.setBreakPoint(f, 2, 0); 150 Debug.setBreakPoint(f, 2, 0);
114 g(); 151 g();
115 152
116 assertFalse(exception, "exception in listener") 153 assertFalse(exception, "exception in listener")
117 // Make sure that the debug event listener vas invoked. 154 // Make sure that the debug event listener vas invoked.
118 assertTrue(listenerComplete, "listener did not run to completion"); 155 assertTrue(listenerComplete, "listener did not run to completion");
OLDNEW
« no previous file with comments | « src/mirror-delay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698