mirror of
https://github.com/github/codeql.git
synced 2026-04-22 15:25:18 +02:00
Add extra tests for partial methods
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
| Partial.cs:3:18:3:39 | PartialMethodWithBody1 | true |
|
||||
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 | true |
|
||||
| Partial.cs:5:17:5:23 | Method2 | false |
|
||||
| Partial.cs:11:17:11:23 | Method3 | false |
|
||||
| Partial.cs:16:18:16:42 | PartialMethodWithoutBody2 | true |
|
||||
| Partial.cs:17:17:17:23 | Method4 | false |
|
||||
| Partial.cs:22:17:22:23 | Method5 | false |
|
||||
7
csharp/ql/test/library-tests/partial/MethodIsPartial.ql
Normal file
7
csharp/ql/test/library-tests/partial/MethodIsPartial.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import csharp
|
||||
|
||||
private boolean isPartial(Method m) { if m.isPartial() then result = true else result = false }
|
||||
|
||||
from Method m
|
||||
where m.fromSource()
|
||||
select m, isPartial(m)
|
||||
@@ -1,11 +1,23 @@
|
||||
partial class A
|
||||
partial class TwoPartClass
|
||||
{
|
||||
partial void M();
|
||||
public void M2() { }
|
||||
partial void PartialMethodWithBody1();
|
||||
partial void PartialMethodWithoutBody1();
|
||||
public void Method2() { }
|
||||
}
|
||||
|
||||
partial class A
|
||||
partial class TwoPartClass
|
||||
{
|
||||
partial void M() { }
|
||||
public void M3() { }
|
||||
partial void PartialMethodWithBody1() { }
|
||||
public void Method3() { }
|
||||
}
|
||||
|
||||
partial class OnePartPartialClass
|
||||
{
|
||||
partial void PartialMethodWithoutBody2();
|
||||
public void Method4() { }
|
||||
}
|
||||
|
||||
class NonPartialClass
|
||||
{
|
||||
public void Method5() { }
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
| Partial.cs:1:15:1:15 | A |
|
||||
| Partial.cs:3:18:3:18 | M |
|
||||
| Partial.cs:7:15:7:15 | A |
|
||||
| Partial.cs:1:15:1:26 | TwoPartClass |
|
||||
| Partial.cs:3:18:3:39 | PartialMethodWithBody1 |
|
||||
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
|
||||
| Partial.cs:8:15:8:26 | TwoPartClass |
|
||||
| Partial.cs:14:15:14:33 | OnePartPartialClass |
|
||||
| Partial.cs:16:18:16:42 | PartialMethodWithoutBody2 |
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
| Partial.cs:1:15:1:15 | A | Partial.cs:3:18:3:18 | M |
|
||||
| Partial.cs:1:15:1:15 | A | Partial.cs:4:17:4:18 | M2 |
|
||||
| Partial.cs:1:15:1:15 | A | Partial.cs:10:17:10:18 | M3 |
|
||||
| Partial.cs:7:15:7:15 | A | Partial.cs:3:18:3:18 | M |
|
||||
| Partial.cs:7:15:7:15 | A | Partial.cs:4:17:4:18 | M2 |
|
||||
| Partial.cs:7:15:7:15 | A | Partial.cs:10:17:10:18 | M3 |
|
||||
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:3:18:3:39 | PartialMethodWithBody1 |
|
||||
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
|
||||
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:5:17:5:23 | Method2 |
|
||||
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:11:17:11:23 | Method3 |
|
||||
| Partial.cs:8:15:8:26 | TwoPartClass | Partial.cs:3:18:3:39 | PartialMethodWithBody1 |
|
||||
| Partial.cs:8:15:8:26 | TwoPartClass | Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
|
||||
| Partial.cs:8:15:8:26 | TwoPartClass | Partial.cs:5:17:5:23 | Method2 |
|
||||
| Partial.cs:8:15:8:26 | TwoPartClass | Partial.cs:11:17:11:23 | Method3 |
|
||||
| Partial.cs:14:15:14:33 | OnePartPartialClass | Partial.cs:16:18:16:42 | PartialMethodWithoutBody2 |
|
||||
| Partial.cs:14:15:14:33 | OnePartPartialClass | Partial.cs:17:17:17:23 | Method4 |
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
| Partial.cs:3:18:3:39 | PartialMethodWithBody1 | true |
|
||||
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 | false |
|
||||
| Partial.cs:16:18:16:42 | PartialMethodWithoutBody2 | false |
|
||||
@@ -0,0 +1,7 @@
|
||||
import csharp
|
||||
|
||||
private boolean hasBody(Method m) { if m.hasBody() then result = true else result = false }
|
||||
|
||||
from Method m
|
||||
where m.fromSource() and m.isPartial()
|
||||
select m, hasBody(m)
|
||||
Reference in New Issue
Block a user