Bug 1518661 - Part 2: Avoid separate count in pause point test. r=jlast
authorLogan Smyth <loganfsmyth@gmail.com>
Wed, 13 Feb 2019 02:55:01 +0000
changeset 458848 fde198422591
parent 458847 b7f9a1180f23
child 458849 82a6589f4b91
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1518661
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518661 - Part 2: Avoid separate count in pause point test. r=jlast Making changes to this test is kind of annoying because the count and the array items need to be kept in sync. This just avoids that. Differential Revision: https://phabricator.services.mozilla.com/D17660
devtools/client/debugger/new/test/mochitest/browser_dbg-pause-points.js
--- a/devtools/client/debugger/new/test/mochitest/browser_dbg-pause-points.js
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-pause-points.js
@@ -1,59 +1,54 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 requestLongerTimeout(2);
 
 async function stepOvers(dbg, count, onStep = () => {}) {
-  let i = 0;
-  while (i++ <= count) {
+  for (let i = 0; i < count; i++) {
     await dbg.actions.stepOver();
     await waitForPaused(dbg);
     onStep(dbg.getState());
   }
 }
 function formatSteps(steps) {
   return steps.map(loc => `(${loc.join(",")})`).join(", ")
 }
 
-async function testCase(dbg, { name, count, steps }) {
+async function testCase(dbg, { name, steps }) {
   invokeInTab(name);
   let locations = [];
 
-  await stepOvers(dbg, count, state => {
+  await stepOvers(dbg, steps.length, state => {
     const {line, column} = dbg.selectors.getTopFrame(state).location
     locations.push([line, column]);
   });
 
   is(formatSteps(locations), formatSteps(steps), name);
   await resume(dbg);
 }
 
 add_task(async function test() {
   const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
 
   await selectSource(dbg, "pause-points.js")
   await testCase(dbg, {
     name: "statements",
-    count: 7,
     steps: [[9,2], [10,4], [10,13], [11,2], [11,21], [12,2], [12,12], [13,0]]
   });
 
   await testCase(dbg, {
     name: "expressions",
-    count: 4,
     steps: [[40,2], [41,2], [41,8], [42,8], [43,0]]
   });
 
   await testCase(dbg, {
     name: "sequences",
-    count: 5,
     steps: [[23,2], [25,8], [29,8], [31,4], [34,2], [37,0]]
 
   });
 
   await testCase(dbg, {
     name: "flow",
-    count: 8,
     steps: [[16,2], [17,12], [18,6], [19,2], [19,8], [19,17], [19,8], [19,17], [19,8]]
   });
 });