Skip to content

Commit 7535a15

Browse files
committed
C#: Add tests and update expected test output.
1 parent 95dc2f7 commit 7535a15

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

csharp/ql/test/library-tests/attributes/AttributeArguments.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ arguments
106106
| attributes.cs:151:6:151:11 | [Params(...)] | 0 | attributes.cs:151:45:151:47 | "a" |
107107
| attributes.cs:151:6:151:11 | [Params(...)] | 1 | attributes.cs:151:36:151:38 | "b" |
108108
| attributes.cs:151:6:151:11 | [Params(...)] | 2 | attributes.cs:151:19:151:29 | array creation of type Int32[] |
109-
| attributes.cs:155:2:155:13 | [Experimental(...)] | 0 | attributes.cs:155:15:155:35 | "MyExperimentalClass" |
110-
| attributes.cs:158:6:158:17 | [Experimental(...)] | 0 | attributes.cs:158:19:158:40 | "MyExperimentalMethod" |
109+
| attributes.cs:155:2:155:13 | [Experimental(...)] | 0 | attributes.cs:155:15:155:37 | "MyExperimentalClassId" |
110+
| attributes.cs:158:6:158:17 | [Experimental(...)] | 0 | attributes.cs:158:19:158:42 | "MyExperimentalMethodId" |
111111
constructorArguments
112112
| Assembly1.dll:0:0:0:0 | [Custom(...)] | 0 | Assembly1.dll:0:0:0:0 | 1 |
113113
| Assembly1.dll:0:0:0:0 | [Custom(...)] | 0 | Assembly1.dll:0:0:0:0 | 3 |
@@ -204,8 +204,8 @@ constructorArguments
204204
| attributes.cs:151:6:151:11 | [Params(...)] | 0 | attributes.cs:151:45:151:47 | "a" |
205205
| attributes.cs:151:6:151:11 | [Params(...)] | 1 | attributes.cs:151:36:151:38 | "b" |
206206
| attributes.cs:151:6:151:11 | [Params(...)] | 2 | attributes.cs:151:19:151:29 | array creation of type Int32[] |
207-
| attributes.cs:155:2:155:13 | [Experimental(...)] | 0 | attributes.cs:155:15:155:35 | "MyExperimentalClass" |
208-
| attributes.cs:158:6:158:17 | [Experimental(...)] | 0 | attributes.cs:158:19:158:40 | "MyExperimentalMethod" |
207+
| attributes.cs:155:2:155:13 | [Experimental(...)] | 0 | attributes.cs:155:15:155:37 | "MyExperimentalClassId" |
208+
| attributes.cs:158:6:158:17 | [Experimental(...)] | 0 | attributes.cs:158:19:158:42 | "MyExperimentalMethodId" |
209209
namedArguments
210210
| Assembly1.dll:0:0:0:0 | [Custom(...)] | Prop2 | Assembly1.dll:0:0:0:0 | array creation of type Object[] |
211211
| Assembly1.dll:0:0:0:0 | [Custom(...)] | Prop2 | Assembly1.dll:0:0:0:0 | array creation of type Object[] |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| attributes.cs:156:14:156:32 | MyExperimentalClass | attributes.cs:155:2:155:13 | [Experimental(...)] | MyExperimentalClassId |
2+
| attributes.cs:159:17:159:36 | MyExperimentalMethod | attributes.cs:158:6:158:17 | [Experimental(...)] | MyExperimentalMethodId |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import csharp
2+
import semmle.code.csharp.frameworks.system.diagnostics.CodeAnalysis
3+
4+
from Attributable element, ExperimentalAttribute attribute
5+
where attribute = element.getAnAttribute() and attribute.fromSource()
6+
select element, attribute, attribute.getId()

csharp/ql/test/library-tests/attributes/PrintAst.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,11 @@ attributes.cs:
465465
#-----| 0: (Attributes)
466466
# 155| 1: [DefaultAttribute] [Experimental(...)]
467467
# 155| -1: [TypeMention] ExperimentalAttribute
468-
# 155| 0: [StringLiteralUtf16] "MyExperimentalClass"
468+
# 155| 0: [StringLiteralUtf16] "MyExperimentalClassId"
469469
# 159| 5: [Method] MyExperimentalMethod
470470
# 159| -1: [TypeMention] Void
471471
#-----| 0: (Attributes)
472472
# 158| 1: [DefaultAttribute] [Experimental(...)]
473473
# 158| -1: [TypeMention] ExperimentalAttribute
474-
# 158| 0: [StringLiteralUtf16] "MyExperimentalMethod"
474+
# 158| 0: [StringLiteralUtf16] "MyExperimentalMethodId"
475475
# 159| 4: [BlockStmt] {...}

csharp/ql/test/library-tests/attributes/attributes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ public void M3() { }
152152
public void M4() { }
153153
}
154154

155-
[Experimental("MyExperimentalClass")]
155+
[Experimental("MyExperimentalClassId")]
156156
public class MyExperimentalClass
157157
{
158-
[Experimental("MyExperimentalMethod")]
158+
[Experimental("MyExperimentalMethodId")]
159159
public void MyExperimentalMethod() { }
160160
}

0 commit comments

Comments
 (0)