mbien commented on code in PR #7387:
URL: https://github.com/apache/netbeans/pull/7387#discussion_r1668451330
##########
php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCCDocumentationTest.java:
##########
@@ -654,6 +654,14 @@ public void testPhpDocAndFunctionInDifferentBlocks_02()
throws Exception {
checkCompletionDocumentation("testfiles/completion/documentation/phpDocAndFunctionInDifferentBlocks.php",
"func2^(1)", false, "");
}
+ public void testFunctionGuessingFloatReturnType_01() throws Exception {
+
checkCompletionDocumentation("testfiles/completion/documentation/functionGuessingFloatReturnType.php",
"testFloatReturn^Type_01();", false, "");
+ }
Review Comment:
this was a bit of a dejavu for me but I can't remember where this happened
before (groovy? javascript? php?)
what do you think about this change:
```diff
diff --git
a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
index 4b21823..8eff017 100644
---
a/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
+++
b/ide/csl.api/test/unit/src/org/netbeans/modules/csl/api/test/CslTestBase.java
@@ -107,6 +107,7 @@
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import javax.swing.JEditorPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentEvent.ElementChange;
@@ -182,6 +183,7 @@
import org.openide.util.Pair;
import org.openide.util.lookup.Lookups;
import org.openide.util.test.MockLookup;
+
import static org.openide.util.test.MockLookup.setLookup;
/**
@@ -3145,13 +3147,12 @@
CodeCompletionResult completionResult =
cc.complete(context);
List<CompletionProposal> proposals =
completionResult.getItems();
- CompletionProposal match = null;
- for (CompletionProposal proposal : proposals) {
- if (proposal.getName().startsWith(itemPrefix)) {
- match = proposal;
- break;
- }
- }
+ List<CompletionProposal> matched = proposals.stream()
+ .filter(p ->
p.getName().startsWith(itemPrefix))
+
.collect(Collectors.toList());
+ assertEquals("more than one item matched the prefix", 1,
matched.size());
+ CompletionProposal match = matched.get(0);
+
assertNotNull(match);
assertNotNull(match.getElement());
```
this would prevent this situation to re-occur, however, this would also
cause many other test failures right now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists