Skip to content
Snippets Groups Projects
Commit eec254a5 authored by Martin Entlicher's avatar Martin Entlicher
Browse files

[GR-6364] testStepOverStatements() test added to prevent from regressions.

parent e0277994
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@ import com.oracle.truffle.api.debug.DebugValue;
import com.oracle.truffle.api.debug.Debugger;
import com.oracle.truffle.api.debug.DebuggerSession;
import com.oracle.truffle.api.debug.SuspendedEvent;
import com.oracle.truffle.api.debug.SuspensionFilter;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.vm.PolyglotEngine;
......@@ -112,6 +113,20 @@ public class FastRDebugTest {
RSource.Internal.DEBUGTEST_FACTORIAL);
}
private static Source createRStatements() {
return RSource.fromTextInternal("foo <- function(a) {\n" +
" x = 2L * a\n" +
"}\n" +
"foo(1)\n" +
"x <- 1:100\n" +
"print(foo(x))\n" +
"y <- sin(x/10)\n" +
"print(foo(y))\n" +
"z <- cos(x^1.3/(runif(1)*5+10))\n" +
"print(foo(z))\n",
RSource.Internal.DEBUGTEST_DEBUG);
}
protected final String getOut() {
return new String(out.toByteArray());
}
......@@ -429,6 +444,37 @@ public class FastRDebugTest {
assertExecutedOK();
}
@Test
public void testStepOverStatements() throws Throwable {
run.addLast(() -> {
assertNull(suspendedEvent);
assertNotNull(debuggerSession);
debuggerSession.setSteppingFilter(SuspensionFilter.newBuilder().ignoreLanguageContextInitialization(true).build());
debuggerSession.suspendNextExecution();
});
assertLocation(1, "foo <- function(a) {\n" +
" x = 2L * a\n" +
"}");
stepOver(1);
assertLocation(4, "foo(1)");
stepOver(1);
assertLocation(5, "x <- 1:100");
stepOver(1);
assertLocation(6, "print(foo(x))");
stepOver(1);
assertLocation(7, "y <- sin(x/10)");
stepOver(1);
assertLocation(8, "print(foo(y))");
stepOver(1);
assertLocation(9, "z <- cos(x^1.3/(runif(1)*5+10))");
stepOver(1);
assertLocation(10, "print(foo(z))");
continueExecution();
performWork();
engine.eval(createRStatements());
assertExecutedOK();
}
private void performWork() {
try {
if (ex == null && !run.isEmpty()) {
......
......@@ -29,7 +29,7 @@ suite = {
{
"name" : "truffle",
"subdir" : True,
"version" : "6fb2134dc266d1ad47f9a6023e8e61fb70c89b4b",
"version" : "f7eb693d02cc090cbaab6ec9dfce0b5d9d22b716",
"urls" : [
{"url" : "https://github.com/graalvm/graal", "kind" : "git"},
{"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment