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

Unified Diff: test/mjsunit/debug-backtrace-text.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/debug-backtrace.js ('k') | test/mjsunit/debug-breakpoints.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-backtrace-text.js
diff --git a/test/mjsunit/debug-backtrace-text.js b/test/mjsunit/debug-backtrace-text.js
index 61648fa4e2e6ee4e8554556db02e18acd93fe0b1..39838c97bb5bd5cb9182f88c05adff3d3a2d17f8 100644
--- a/test/mjsunit/debug-backtrace-text.js
+++ b/test/mjsunit/debug-backtrace-text.js
@@ -31,19 +31,20 @@
function Point(x, y) {
this.x = x;
this.y = y;
-};
+}
Point.prototype.distanceTo = function(p) {
debugger;
- return Math.sqrt(Math.pow(Math.abs(this.x - p.x), 2) + Math.pow(Math.abs(this.y - p.y), 2))
-}
+ return Math.sqrt(Math.pow(Math.abs(this.x - p.x), 2) +
+ Math.pow(Math.abs(this.y - p.y), 2));
+};
p1 = new Point(1,1);
p2 = new Point(2,2);
p1.distanceTo = function(p) {
return p.distanceTo(this);
-}
+};
function distance(p, q) {
return p.distanceTo(q);
@@ -56,7 +57,7 @@ function createPoint(x, y) {
a=[1,2,distance];
// Get the Debug object exposed from the debug context global object.
-Debug = debug.Debug
+Debug = debug.Debug;
testConstructor = false; // Flag to control which part of the test is run.
listenerCalled = false;
@@ -72,44 +73,48 @@ function safeEval(code) {
function listener(event, exec_state, event_data, data) {
try {
- if (event == Debug.DebugEvent.Break)
- {
- if (!testConstructor) {
- // The expected backtrace is
- // 0: Call distance on Point where distance is a property on the prototype
- // 1: Call distance on Point where distance is a direct property
- // 2: Call on function an array element 2
- // 3: [anonymous]
- assertEquals("#<Point>.distanceTo(p=#<Point>)", exec_state.frame(0).invocationText());
- assertEquals("#<Point>.distanceTo(p=#<Point>)", exec_state.frame(1).invocationText());
- assertEquals("#<Array>[2](aka distance)(p=#<Point>, q=#<Point>)", exec_state.frame(2).invocationText());
- assertEquals("[anonymous]()", exec_state.frame(3).invocationText());
- listenerCalled = true;
- } else {
- // The expected backtrace is
- // 0: Call Point constructor
- // 1: Call on global function createPoint
- // 2: [anonymous]
- assertEquals("new Point(x=0, y=0)", exec_state.frame(0).invocationText());
- assertEquals("createPoint(x=0, y=0)", exec_state.frame(1).invocationText());
- assertEquals("[anonymous]()", exec_state.frame(2).invocationText());
- listenerCalled = true;
+ if (event == Debug.DebugEvent.Break) {
+ if (!testConstructor) {
+ // The expected backtrace is
+ // 0: Call distance on Point where distance is a property on the prototype
+ // 1: Call distance on Point where distance is a direct property
+ // 2: Call on function an array element 2
+ // 3: [anonymous]
+ assertEquals("#<Point>.distanceTo(p=#<Point>)",
+ exec_state.frame(0).invocationText());
+ assertEquals("#<Point>.distanceTo(p=#<Point>)",
+ exec_state.frame(1).invocationText());
+ assertEquals("#<Array>[2](aka distance)(p=#<Point>, q=#<Point>)",
+ exec_state.frame(2).invocationText());
+ assertEquals("[anonymous]()", exec_state.frame(3).invocationText());
+ listenerCalled = true;
+ } else {
+ // The expected backtrace is
+ // 0: Call Point constructor
+ // 1: Call on global function createPoint
+ // 2: [anonymous]
+ assertEquals("new Point(x=0, y=0)",
+ exec_state.frame(0).invocationText());
+ assertEquals("createPoint(x=0, y=0)",
+ exec_state.frame(1).invocationText());
+ assertEquals("[anonymous]()", exec_state.frame(2).invocationText());
+ listenerCalled = true;
+ }
}
- }
} catch (e) {
- exception = e
- };
-};
+ exception = e;
+ }
+}
// Add the debug event listener.
Debug.setListener(listener);
// Set a break point and call to invoke the debug event listener.
-a[2](p1, p2)
+a[2](p1, p2);
// Make sure that the debug event listener vas invoked.
assertTrue(listenerCalled);
-assertFalse(exception, "exception in listener")
+assertFalse(exception, "exception in listener");
// Set a break point and call to invoke the debug event listener.
listenerCalled = false;
@@ -119,4 +124,4 @@ createPoint(0, 0);
// Make sure that the debug event listener vas invoked (again).
assertTrue(listenerCalled);
-assertFalse(exception, "exception in listener")
+assertFalse(exception, "exception in listener");
« no previous file with comments | « test/mjsunit/debug-backtrace.js ('k') | test/mjsunit/debug-breakpoints.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698