Add extra tests for partial methods

This commit is contained in:
Tamas Vajk
2020-08-18 10:26:31 +02:00
parent eba2c4331f
commit beeadea48f
7 changed files with 58 additions and 15 deletions

View File

@@ -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 |

View 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)

View File

@@ -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() { }
}

View File

@@ -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 |

View File

@@ -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 |

View File

@@ -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 |

View File

@@ -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)