forked from apache/netbeans
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#7599 from junichi11/php-gh-7594-cc-throwabl…
…e-error Add the `Error` class and the `Throwable` interface as completion items for exceptions [apacheGH-7594]
- Loading branch information
Showing
10 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
php/php.editor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
try { | ||
|
||
} catch(Thr) { | ||
|
||
} | ||
|
||
try { | ||
|
||
} catch(\Thr) { | ||
|
||
} | ||
|
||
try { | ||
|
||
} catch(Err) { | ||
|
||
} | ||
|
||
try { | ||
|
||
} catch(\Err) { | ||
|
||
} | ||
|
||
try { | ||
|
||
} catch(TypeE) { | ||
|
||
} | ||
|
||
try { | ||
|
||
} catch(\TypeE) { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_01a.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(Thr|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS Throwable [PUBLIC] stub.php |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_01b.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(\Thr|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS Throwable [PUBLIC] stub.php |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_02a.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(Err|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS Error [PUBLIC] stub.php |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_02b.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(\Err|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS Error [PUBLIC] stub.php |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_03a.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(TypeE|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS TypeError [PUBLIC] stub.php |
5 changes: 5 additions & 0 deletions
5
...ditor/test/unit/data/testfiles/completion/lib/gh7594/gh7594.php.testGH7594_03b.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Code completion result for source line: | ||
} catch(\TypeE|) { | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
CLASS TypeError [PUBLIC] stub.php |
25 changes: 25 additions & 0 deletions
25
php/php.editor/test/unit/data/testfiles/completion/lib/gh7594/stub.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
interface Throwable extends Stringable {} | ||
|
||
class Error implements \Throwable {} | ||
|
||
class TypeError extends \Error {} |
59 changes: 59 additions & 0 deletions
59
...test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionGH7594Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.php.editor.completion; | ||
|
||
import java.io.File; | ||
import org.openide.filesystems.FileObject; | ||
import org.openide.filesystems.FileUtil; | ||
|
||
public class PHPCodeCompletionGH7594Test extends PHPCodeCompletionTestBase { | ||
|
||
public PHPCodeCompletionGH7594Test(String testName) { | ||
super(testName); | ||
} | ||
|
||
@Override | ||
protected FileObject[] createSourceClassPathsForTest() { | ||
return new FileObject[]{FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/gh7594/"))}; | ||
} | ||
|
||
public void testGH7594_01a() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(Thr^) {", false); | ||
} | ||
|
||
public void testGH7594_01b() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(\\Thr^) {", false); | ||
} | ||
|
||
public void testGH7594_02a() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(Err^) {", false); | ||
} | ||
|
||
public void testGH7594_02b() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(\\Err^) {", false); | ||
} | ||
|
||
public void testGH7594_03a() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(TypeE^) {", false); | ||
} | ||
|
||
public void testGH7594_03b() throws Exception { | ||
checkCompletion("testfiles/completion/lib/gh7594/gh7594.php", "} catch(\\TypeE^) {", false); | ||
} | ||
} |