From 380f8bc4555a58699a182a2d41693a4703b6d82e Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Thu, 29 Jun 2017 18:42:12 +0200
Subject: [PATCH] Implemented test for conditional breakpoints.

---
 .../truffle/r/test/tck/FastRDebugTest.java    | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
index 134b0b01d3..ecc44d636b 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
@@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.oracle.truffle.api.debug.Breakpoint;
@@ -154,6 +155,39 @@ public class FastRDebugTest {
         assertEquals("Factorial computed OK", 2, n.intValue());
     }
 
+    /**
+     * Test is currently ignored because of missing functionality in Truffle.
+     */
+    @Test
+    @Ignore
+    public void testConditionalBreakpoint() throws Throwable {
+        final Source source = RSource.fromTextInternal("main <- function() {\n" +
+                        "  for(i in seq(10)) {\n" +
+                        "    print(i)\n" +
+                        "  }\n" +
+                        "}\n",
+                        RSource.Internal.DEBUGTEST_DEBUG);
+        engine.eval(source);
+
+        run.addLast(() -> {
+            assertNull(suspendedEvent);
+            assertNotNull(debuggerSession);
+            Breakpoint breakpoint = Breakpoint.newBuilder(source).lineIs(3).build();
+            breakpoint.setCondition("i == 5");
+            debuggerSession.install(breakpoint);
+        });
+
+        assertLocation(3, "print(i)", "i", "5");
+        continueExecution();
+
+        // Init before eval:
+        performWork();
+
+        final Source evalSrc = RSource.fromTextInternal("main()\n", RSource.Internal.DEBUGTEST_DEBUG);
+        engine.eval(evalSrc);
+        assertExecutedOK();
+    }
+
     @Test
     public void stepInStepOver() throws Throwable {
         final Source factorial = createFactorial();
-- 
GitLab