Skip to content

Commit 2b78a7b

Browse files
committed
C#: Add PartialEvent test case.
1 parent 7d17454 commit 2b78a7b

12 files changed

+168
-131
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 | true |
2-
| Partial.cs:5:17:5:23 | Method2 | false |
3-
| Partial.cs:14:18:14:39 | PartialMethodWithBody1 | true |
4-
| Partial.cs:15:17:15:23 | Method3 | false |
5-
| Partial.cs:34:18:34:42 | PartialMethodWithoutBody2 | true |
6-
| Partial.cs:35:17:35:23 | Method4 | false |
7-
| Partial.cs:40:17:40:23 | Method5 | false |
1+
| Partial.cs:6:18:6:42 | PartialMethodWithoutBody1 | true |
2+
| Partial.cs:7:17:7:23 | Method2 | false |
3+
| Partial.cs:18:18:18:39 | PartialMethodWithBody1 | true |
4+
| Partial.cs:19:17:19:23 | Method3 | false |
5+
| Partial.cs:41:18:41:42 | PartialMethodWithoutBody2 | true |
6+
| Partial.cs:42:17:42:23 | Method4 | false |
7+
| Partial.cs:47:17:47:23 | Method5 | false |

csharp/ql/test/library-tests/partial/Partial.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
partial class TwoPartClass
24
{
35
partial void PartialMethodWithBody1();
@@ -7,6 +9,8 @@ public void Method2() { }
79
public partial object PartialProperty1 { get; set; }
810
// Declaring declaration.
911
public partial object this[int index] { get; set; }
12+
// Declaring declaration.
13+
public partial event EventHandler PartialEvent1;
1014
}
1115

1216
partial class TwoPartClass
@@ -27,6 +31,9 @@ public partial object this[int index]
2731
get { return _backingArray[index]; }
2832
set { _backingArray[index] = value; }
2933
}
34+
35+
// Implementation declaration.
36+
public partial event EventHandler PartialEvent1 { add { } remove { } }
3037
}
3138

3239
partial class OnePartPartialClass
@@ -44,4 +51,5 @@ public object this[int index]
4451
get { return null; }
4552
set { }
4653
}
54+
public event EventHandler Event;
4755
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
| Partial.cs:1:15:1:26 | TwoPartClass |
2-
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
3-
| Partial.cs:12:15:12:26 | TwoPartClass |
4-
| Partial.cs:14:18:14:39 | PartialMethodWithBody1 |
5-
| Partial.cs:18:27:18:42 | PartialProperty1 |
6-
| Partial.cs:20:9:20:11 | get_PartialProperty1 |
7-
| Partial.cs:21:9:21:11 | set_PartialProperty1 |
8-
| Partial.cs:25:27:25:30 | Item |
9-
| Partial.cs:27:9:27:11 | get_Item |
10-
| Partial.cs:28:9:28:11 | set_Item |
11-
| Partial.cs:32:15:32:33 | OnePartPartialClass |
12-
| Partial.cs:34:18:34:42 | PartialMethodWithoutBody2 |
1+
| Partial.cs:3:15:3:26 | TwoPartClass |
2+
| Partial.cs:6:18:6:42 | PartialMethodWithoutBody1 |
3+
| Partial.cs:16:15:16:26 | TwoPartClass |
4+
| Partial.cs:18:18:18:39 | PartialMethodWithBody1 |
5+
| Partial.cs:22:27:22:42 | PartialProperty1 |
6+
| Partial.cs:24:9:24:11 | get_PartialProperty1 |
7+
| Partial.cs:25:9:25:11 | set_PartialProperty1 |
8+
| Partial.cs:29:27:29:30 | Item |
9+
| Partial.cs:31:9:31:11 | get_Item |
10+
| Partial.cs:32:9:32:11 | set_Item |
11+
| Partial.cs:39:15:39:33 | OnePartPartialClass |
12+
| Partial.cs:41:18:41:42 | PartialMethodWithoutBody2 |
1313
| PartialMultipleFiles1.cs:1:22:1:41 | PartialMultipleFiles |
1414
| PartialMultipleFiles2.cs:1:22:1:41 | PartialMultipleFiles |
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:1:15:1:26 | <object initializer> |
2-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
3-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:5:17:5:23 | Method2 |
4-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:14:18:14:39 | PartialMethodWithBody1 |
5-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:15:17:15:23 | Method3 |
6-
| Partial.cs:12:15:12:26 | TwoPartClass | Partial.cs:1:15:1:26 | <object initializer> |
7-
| Partial.cs:12:15:12:26 | TwoPartClass | Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 |
8-
| Partial.cs:12:15:12:26 | TwoPartClass | Partial.cs:5:17:5:23 | Method2 |
9-
| Partial.cs:12:15:12:26 | TwoPartClass | Partial.cs:14:18:14:39 | PartialMethodWithBody1 |
10-
| Partial.cs:12:15:12:26 | TwoPartClass | Partial.cs:15:17:15:23 | Method3 |
11-
| Partial.cs:32:15:32:33 | OnePartPartialClass | Partial.cs:32:15:32:33 | <object initializer> |
12-
| Partial.cs:32:15:32:33 | OnePartPartialClass | Partial.cs:34:18:34:42 | PartialMethodWithoutBody2 |
13-
| Partial.cs:32:15:32:33 | OnePartPartialClass | Partial.cs:35:17:35:23 | Method4 |
1+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:3:15:3:26 | <object initializer> |
2+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:6:18:6:42 | PartialMethodWithoutBody1 |
3+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:7:17:7:23 | Method2 |
4+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:18:18:18:39 | PartialMethodWithBody1 |
5+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:19:17:19:23 | Method3 |
6+
| Partial.cs:16:15:16:26 | TwoPartClass | Partial.cs:3:15:3:26 | <object initializer> |
7+
| Partial.cs:16:15:16:26 | TwoPartClass | Partial.cs:6:18:6:42 | PartialMethodWithoutBody1 |
8+
| Partial.cs:16:15:16:26 | TwoPartClass | Partial.cs:7:17:7:23 | Method2 |
9+
| Partial.cs:16:15:16:26 | TwoPartClass | Partial.cs:18:18:18:39 | PartialMethodWithBody1 |
10+
| Partial.cs:16:15:16:26 | TwoPartClass | Partial.cs:19:17:19:23 | Method3 |
11+
| Partial.cs:39:15:39:33 | OnePartPartialClass | Partial.cs:39:15:39:33 | <object initializer> |
12+
| Partial.cs:39:15:39:33 | OnePartPartialClass | Partial.cs:41:18:41:42 | PartialMethodWithoutBody2 |
13+
| Partial.cs:39:15:39:33 | OnePartPartialClass | Partial.cs:42:17:42:23 | Method4 |
1414
| PartialMultipleFiles1.cs:1:22:1:41 | PartialMultipleFiles | PartialMultipleFiles1.cs:1:22:1:41 | <object initializer> |
1515
| PartialMultipleFiles2.cs:1:22:1:41 | PartialMultipleFiles | PartialMultipleFiles1.cs:1:22:1:41 | <object initializer> |
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
| Partial.cs:20:9:20:11 | get_PartialProperty1 | true |
2-
| Partial.cs:21:9:21:11 | set_PartialProperty1 | true |
3-
| Partial.cs:27:9:27:11 | get_Item | true |
4-
| Partial.cs:28:9:28:11 | set_Item | true |
5-
| Partial.cs:41:30:41:32 | get_Property | false |
6-
| Partial.cs:41:35:41:37 | set_Property | false |
7-
| Partial.cs:44:9:44:11 | get_Item | false |
8-
| Partial.cs:45:9:45:11 | set_Item | false |
1+
| Partial.cs:13:39:13:51 | add_PartialEvent1 | false |
2+
| Partial.cs:13:39:13:51 | remove_PartialEvent1 | false |
3+
| Partial.cs:24:9:24:11 | get_PartialProperty1 | true |
4+
| Partial.cs:25:9:25:11 | set_PartialProperty1 | true |
5+
| Partial.cs:31:9:31:11 | get_Item | true |
6+
| Partial.cs:32:9:32:11 | set_Item | true |
7+
| Partial.cs:48:30:48:32 | get_Property | false |
8+
| Partial.cs:48:35:48:37 | set_Property | false |
9+
| Partial.cs:51:9:51:11 | get_Item | false |
10+
| Partial.cs:52:9:52:11 | set_Item | false |
11+
| Partial.cs:54:31:54:35 | add_Event | false |
12+
| Partial.cs:54:31:54:35 | remove_Event | false |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| Partial.cs:1:15:1:26 | TwoPartClass | Partial.cs:1:15:1:26 | {...} |
2-
| Partial.cs:32:15:32:33 | OnePartPartialClass | Partial.cs:32:15:32:33 | {...} |
3-
| Partial.cs:38:7:38:21 | NonPartialClass | Partial.cs:38:7:38:21 | {...} |
1+
| Partial.cs:3:15:3:26 | TwoPartClass | Partial.cs:3:15:3:26 | {...} |
2+
| Partial.cs:39:15:39:33 | OnePartPartialClass | Partial.cs:39:15:39:33 | {...} |
3+
| Partial.cs:45:7:45:21 | NonPartialClass | Partial.cs:45:7:45:21 | {...} |
44
| PartialMultipleFiles1.cs:1:22:1:41 | PartialMultipleFiles | PartialMultipleFiles1.cs:1:22:1:41 | {...} |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| Partial.cs:13:39:13:51 | PartialEvent1 | false |
2+
| Partial.cs:54:31:54:35 | Event | false |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import csharp
2+
3+
private boolean isPartial(Event e) { if e.isPartial() then result = true else result = false }
4+
5+
from Event e
6+
where e.fromSource()
7+
select e, isPartial(e)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| Partial.cs:25:27:25:30 | Item | true |
2-
| Partial.cs:42:19:42:22 | Item | false |
1+
| Partial.cs:29:27:29:30 | Item | true |
2+
| Partial.cs:49:19:49:22 | Item | false |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| Partial.cs:4:18:4:42 | PartialMethodWithoutBody1 | false |
2-
| Partial.cs:14:18:14:39 | PartialMethodWithBody1 | true |
3-
| Partial.cs:34:18:34:42 | PartialMethodWithoutBody2 | false |
1+
| Partial.cs:6:18:6:42 | PartialMethodWithoutBody1 | false |
2+
| Partial.cs:18:18:18:39 | PartialMethodWithBody1 | true |
3+
| Partial.cs:41:18:41:42 | PartialMethodWithoutBody2 | false |

0 commit comments

Comments
 (0)