MCPcopy Index your code
hub / github.com/Col-E/Recaf / testValue

Method testValue

src/test/java/me/coley/recaf/SearchTest.java:50–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48 }
49
50 @Test
51 public void testValue() {
52 // Setup search - Calculator.MAX_DEPTH = 30
53 // - Javac inlines constants, but keeps the field constant value attribute
54 // - So there should be the field const and the inline value in results
55 SearchCollector collector = SearchBuilder.in(workspace).skipDebug()
56 .query(new ValueQuery(30)).build();
57 // Show results
58 List<SearchResult> results = collector.getAllResults();
59 assertEquals(2, results.size());
60 ValueResult resField = (ValueResult) results.get(0);
61 contextEquals(resField.getContext(), "calc/Calculator", "MAX_DEPTH", "I");
62 ValueResult resInsn = (ValueResult) results.get(1);
63 contextEquals(resInsn.getContext().getParent(), "calc/Calculator", "evaluate", "(ILjava/lang/String;)D");
64 }
65
66 @Test
67 public void testOverlappingResultsInMethodCode() {

Callers

nothing calls this directly

Calls 10

inMethod · 0.95
getAllResultsMethod · 0.95
contextEqualsMethod · 0.95
queryMethod · 0.80
skipDebugMethod · 0.80
buildMethod · 0.65
sizeMethod · 0.45
getMethod · 0.45
getContextMethod · 0.45
getParentMethod · 0.45

Tested by

no test coverage detected