Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2020 Gayan Perera and others. |
3 |
* |
4 |
* This program and the accompanying materials |
5 |
* are made available under the terms of the Eclipse Public License 2.0 |
6 |
* which accompanies this distribution, and is available at |
7 |
* https://www.eclipse.org/legal/epl-2.0/ |
8 |
* |
9 |
* SPDX-License-Identifier: EPL-2.0 |
10 |
* |
11 |
*******************************************************************************/ |
12 |
package org.eclipse.jdt.debug.tests.eval; |
13 |
|
14 |
import org.eclipse.debug.core.model.IValue; |
15 |
import org.eclipse.jdt.core.IJavaProject; |
16 |
import org.eclipse.jdt.debug.core.IJavaThread; |
17 |
import org.eclipse.jdt.debug.tests.AbstractDebugTest; |
18 |
|
19 |
public class LambdaNestedVariableTest extends AbstractDebugTest { |
20 |
|
21 |
@Override |
22 |
protected IJavaProject getProjectContext() { |
23 |
return get18Project(); |
24 |
} |
25 |
|
26 |
public LambdaNestedVariableTest(String name) { |
27 |
super(name); |
28 |
} |
29 |
|
30 |
public void testEvaluate_LambdaCapturedParameter() throws Exception { |
31 |
IJavaThread thread = null; |
32 |
try { |
33 |
String type = "Bug569413"; |
34 |
createLineBreakpoint(21, type); |
35 |
thread = launchToBreakpoint(type); |
36 |
|
37 |
IValue value = doEval(thread, "p"); |
38 |
assertEquals("wrong type : ", "java.lang.String", value.getReferenceTypeName()); |
39 |
assertEquals("wrong result : ", "ab", value.getValueString()); |
40 |
|
41 |
assertNotNull("The program did not suspend", thread); |
42 |
} finally { |
43 |
removeAllBreakpoints(); |
44 |
terminateAndRemove(thread); |
45 |
} |
46 |
} |
47 |
|
48 |
public void testEvaluate_LambdaCapturedParameterAndNull() throws Exception { |
49 |
IJavaThread thread = null; |
50 |
try { |
51 |
String type = "Bug569413"; |
52 |
createLineBreakpoint(28, type); |
53 |
thread = launchToBreakpoint(type); |
54 |
|
55 |
IValue value = doEval(thread, "p"); |
56 |
assertEquals("wrong type : ", "java.lang.String", value.getReferenceTypeName()); |
57 |
assertEquals("wrong result : ", "ab", value.getValueString()); |
58 |
|
59 |
assertNotNull("The program did not suspend", thread); |
60 |
} finally { |
61 |
removeAllBreakpoints(); |
62 |
terminateAndRemove(thread); |
63 |
} |
64 |
} |
65 |
|
66 |
} |