use of com.walmartlabs.concord.svm.InMemoryState in project concord by walmartlabs.
the class VMUtilsTest method testLocals.
@Test
public void testLocals() {
Frame rootFrame = Frame.builder().root().locals(Collections.singletonMap("x", 123)).build();
State state = new InMemoryState(rootFrame);
ThreadId threadId = state.getRootThreadId();
Frame levelOneFrame = Frame.builder().nonRoot().locals(Collections.singletonMap("y", 234)).build();
state.pushFrame(threadId, levelOneFrame);
Frame levelTwoFrame = Frame.builder().nonRoot().locals(Collections.singletonMap("x", 345)).build();
state.pushFrame(threadId, levelTwoFrame);
Map<String, Object> locals = VMUtils.getCombinedLocals(state, threadId);
assertEquals(2, locals.size());
assertEquals(345, locals.get("x"));
assertEquals(234, locals.get("y"));
}
Aggregations