tmysik closed pull request #1021: Fix the unit test for CC in php.editor
URL: https://github.com/apache/incubator-netbeans/pull/1021
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 85e9adfc49..e37b66a9b5 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
@@ -2664,6 +2664,7 @@ public void checkCompletion(final String file, final
String caretLine, final boo
caretOffset = -1;
}
+ final String[] described = new String[1];
UserTask task = new UserTask() {
public @Override void run(ResultIterator resultIterator) throws
Exception {
Parser.Result r = caretOffset == -1 ?
resultIterator.getParserResult() : resultIterator.getParserResult(caretOffset);
@@ -2783,17 +2784,18 @@ public String getText() {
}
};
- String described = describeCompletion(caretLine,
pr.getSnapshot().getSource().createSnapshot().getText().toString(),
caretOffset, true, caseSensitive, type, proposals, includeModifiers,
deprecatedHolder, formatter);
- assertDescriptionMatches(file, described, true, ".completion");
+ described[0] = describeCompletion(caretLine,
pr.getSnapshot().getSource().createSnapshot().getText().toString(),
caretOffset, true, caseSensitive, type, proposals, includeModifiers,
deprecatedHolder, formatter);
}
};
if (classPathsForTest == null || classPathsForTest.isEmpty()) {
ParserManager.parse(Collections.singleton(testSource), task);
+ assertDescriptionMatches(file, described[0], true, ".completion");
} else {
Future<Void> future =
ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
if (!future.isDone()) {
future.get();
}
+ assertDescriptionMatches(file, described[0], true, ".completion");
}
}
diff --git
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
index d5eff59ae1..d94f81c8c4 100644
---
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
+++
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
@@ -286,6 +286,10 @@ public CodeCompletionResult complete(CodeCompletionContext
completionContext) {
case GROUP_USE_FUNCTION_KEYWORD:
searchPrefix = getPrefix(info, findBaseNamespaceEnd(info,
caretOffset), true, PrefixBreaker.WITH_NS_PARTS);
break;
+ case EXPRESSION: // no break
+ if (prefix.startsWith("@")) { // NOI18N
+ prefix = prefix.substring(1);
+ }
default:
searchPrefix = null;
break;
diff --git
a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion163432Test.java
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion163432Test.java
index 794fad2891..ba3d9bb61f 100644
---
a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion163432Test.java
+++
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion163432Test.java
@@ -23,7 +23,6 @@
import java.util.Collections;
import java.util.Map;
import org.netbeans.api.java.classpath.ClassPath;
-import org.netbeans.junit.RandomlyFails;
import org.netbeans.modules.php.project.api.PhpSourcePath;
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
import org.openide.filesystems.FileObject;
@@ -39,10 +38,10 @@ public PHPCodeCompletion163432Test(String testName) {
super(testName);
}
- @RandomlyFails
public void test163432() throws Exception {
checkCompletion("testfiles/completion/lib/test163432/test.php",
"@fn^", false);
}
+
public void test163432_1() throws Exception {
checkCompletion("testfiles/completion/lib/test163432/test.php",
"@$cls163432->^", false);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
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