1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 436349 - JUnit test for step-return for a method returning void

Change-Id: Ia449c9f599e6c5c3af9e26b4014ade6a12ae58c3
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/27735
Tested-by: Hudson CI
This commit is contained in:
Marc Khouzam 2014-06-02 11:24:25 -04:00
parent 93fe0e78c3
commit 8c15651c03
2 changed files with 30 additions and 0 deletions

View file

@ -365,6 +365,12 @@ int testRTTI() {
}
// End of bug 376901 RTTI tests
void noReturnValue() {
int a = 0;
a++;
return;
}
int testSimpleReturn(int a) {
int b = 0;
b = a;
@ -384,6 +390,7 @@ void testReturn() {
testSimpleReturn(6);
testComplexReturn();
noReturnValue();
a = 0;
}

View file

@ -4105,6 +4105,29 @@ public class MIExpressionsTest extends BaseTestCase {
assertEquals("b", result[0].getName());
}
/**
* This test verifies that we properly display variables after a step-return operation
* from a method returning void.
*/
@Test
public void testNoReturnValueForEmptyStepReturn() throws Throwable {
SyncUtil.runToLocation("noReturnValue");
MIStoppedEvent stoppedEvent = SyncUtil.step(1, StepType.STEP_RETURN);
// Check no return value is shown when looking at the first frame
final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
IVariableDMData[] result = SyncUtil.getLocals(frameDmc);
assertEquals(2, result.length); // Two variables and one return value
// first variable
assertEquals("a", result[0].getName());
assertEquals("10", result[0].getValue());
// Second variable
assertEquals("b", result[1].getName());
assertEquals("false", result[1].getValue());
}
/**
* This tests verifies that we can obtain a child even though
* is was already created directly.