Port some debug-info tests to running debug tests.

R=ager, shertz

Change-Id: Ib2d243099f38343e951cf9c23b4b61ddfab276c8
diff --git a/src/test/debugTestResources/Locals.java b/src/test/debugTestResources/Locals.java
index 3ab5d7b..d42dd61 100644
--- a/src/test/debugTestResources/Locals.java
+++ b/src/test/debugTestResources/Locals.java
@@ -211,6 +211,39 @@
 
   public static void nop() {}
 
+  public static int tempInCase(int x) {
+    int res = 0;
+    for (int i = 0; i < x; ++i) {
+      int rem = x - i;
+      switch (rem) {
+        case 1:
+          return res;
+        case 5:
+          int tmp = res + x + i;
+          res += tmp;
+          break;
+        case 10:
+          i++;
+          break;
+        default:
+          res += rem;
+      }
+      res += rem % 2;
+    }
+    res *= x;
+    return res;
+  }
+
+  public static int localSwap(int x, int y) {
+    int sum = x + y;
+    {
+      int t = x;
+      x = y;
+      y = t;
+    }
+    return sum + x + y;
+  }
+
   public static void main(String[] args) {
     noLocals();
     unusedLocals();
@@ -224,6 +257,7 @@
     stepEmptyForLoopBody1(3);
     stepEmptyForLoopBody2(3);
     stepNonEmptyForLoopBody(3);
+    tempInCase(42);
+    localSwap(1, 2);
   }
-
 }
diff --git a/src/test/java/com/android/tools/r8/debug/LocalsTest.java b/src/test/java/com/android/tools/r8/debug/LocalsTest.java
index 16d1a60..02fb694 100644
--- a/src/test/java/com/android/tools/r8/debug/LocalsTest.java
+++ b/src/test/java/com/android/tools/r8/debug/LocalsTest.java
@@ -423,4 +423,51 @@
         checkLocal("i", I3),
         run());
   }
+
+  @Test
+  public void tempInCase() throws Throwable {
+    runDebugTest(
+        "Locals",
+        breakpoint("Locals", "tempInCase"),
+        run(),
+        checkLine(SOURCE_FILE, 215),
+        checkLocal("x", Value.createInt(42)),
+        stepOver(),
+        checkLine(SOURCE_FILE, 216),
+        checkLocal("res", Value.createInt(0)),
+        checkNoLocal("i"),
+        stepOver(),
+        checkLine(SOURCE_FILE, 217),
+        stepOver(),
+        checkLine(SOURCE_FILE, 218),
+        checkLocal("rem", Value.createInt(42)),
+        setLocal("rem", Value.createInt(1)),
+        stepOver(),
+        checkLine(SOURCE_FILE, 220),
+        checkLocal("res", Value.createInt(0)),
+        run());
+  }
+
+  @Test
+  public void localSwap() throws Throwable {
+    runDebugTest(
+        "Locals",
+        breakpoint("Locals", "localSwap"),
+        run(),
+        checkLine(SOURCE_FILE, 238),
+        stepOver(),
+        checkLine(SOURCE_FILE, 240),
+        stepOver(),
+        checkLine(SOURCE_FILE, 241),
+        checkLocal("x", Value.createInt(1)),
+        checkLocal("y", Value.createInt(2)),
+        checkLocal("t", Value.createInt(1)),
+        stepOver(),
+        stepOver(),
+        checkLine(SOURCE_FILE, 244),
+        checkLocal("x", Value.createInt(2)),
+        checkLocal("y", Value.createInt(1)),
+        checkNoLocal("t"),
+        run());
+  }
 }
diff --git a/src/test/java/com/android/tools/r8/debuginfo/BackBranchToSelfTestRunner.java b/src/test/java/com/android/tools/r8/debuginfo/BackBranchToSelfTestRunner.java
index 24eae68..0ad8ecd 100644
--- a/src/test/java/com/android/tools/r8/debuginfo/BackBranchToSelfTestRunner.java
+++ b/src/test/java/com/android/tools/r8/debuginfo/BackBranchToSelfTestRunner.java
@@ -22,11 +22,11 @@
     assertEquals(expected, runOnArt(d8App, clazz.getCanonicalName()));
     assertEquals(expected, runOnArt(dxApp, clazz.getCanonicalName()));
 
-    checkBackBranchToSelf(inspectMethod(d8App, clazz, "int", "backBranchToSelf", "boolean"), false);
-    checkBackBranchToSelf(inspectMethod(dxApp, clazz, "int", "backBranchToSelf", "boolean"), true);
+    checkBackBranchToSelf(inspectMethod(d8App, clazz, "int", "backBranchToSelf", "boolean"));
+    checkBackBranchToSelf(inspectMethod(dxApp, clazz, "int", "backBranchToSelf", "boolean"));
   }
 
-  private void checkBackBranchToSelf(DebugInfoInspector info, boolean dx) {
+  private void checkBackBranchToSelf(DebugInfoInspector info) {
     info.checkStartLine(10);
     info.checkLineHasExactLocals(10, "loop", "boolean");
     info.checkNoLine(11);