Skip to content

Commit 478474b

Browse files
committed
C#: Add ref field test case.
1 parent ecadb56 commit 478474b

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,24 @@ Strings.cs:
612612
# 53| 1: [StringLiteralUtf8] "The nested message
613613
# 53| is UTF-8 encoded and
614614
# 53| spans multiple lines."
615+
Struct.cs:
616+
# 1| [NamespaceDeclaration] namespace ... { ... }
617+
# 3| 1: [Class] MyEmptyClass
618+
# 5| 2: [Struct] RefStruct
619+
# 7| 5: [Field] MyInt
620+
# 7| -1: [TypeMention] int
621+
# 8| 6: [Field] MyByte
622+
# 8| -1: [TypeMention] byte
623+
# 9| 7: [Field] MyObject
624+
# 9| -1: [TypeMention] object
625+
# 10| 8: [Field] MyEmptyClass
626+
# 10| -1: [TypeMention] MyEmptyClass
627+
# 11| 9: [Field] MyReadonlyByte
628+
# 11| -1: [TypeMention] byte
629+
# 12| 10: [Field] MyReadonlyObject
630+
# 12| -1: [TypeMention] object
631+
# 13| 11: [Field] MyReadonlyString
632+
# 13| -1: [TypeMention] string
615633
cil/class1.cs:
616634
# 4| [Class] Class1
617635
# 6| 5: [Method] Main

csharp/ql/test/library-tests/csharp11/Struct.cs_ renamed to csharp/ql/test/library-tests/csharp11/Struct.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// TODO: Test needs to be enabled when .NET 7 is used as the runtime.
2-
namespace structassembly;
1+
namespace structassembly;
32

43
public class MyEmptyClass { }
54

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
reffields
2+
| Struct.cs:8:21:8:26 | MyByte |
3+
| Struct.cs:9:23:9:30 | MyObject |
4+
| Struct.cs:10:31:10:42 | MyEmptyClass |
5+
| Struct.cs:12:32:12:47 | MyReadonlyObject |
26
readonlyreffields
7+
| Struct.cs:11:30:11:43 | MyReadonlyByte |
8+
| Struct.cs:13:41:13:56 | MyReadonlyString |
39
readonlyfield
10+
| Struct.cs:12:32:12:47 | MyReadonlyObject |
11+
| Struct.cs:13:41:13:56 | MyReadonlyString |

0 commit comments

Comments
 (0)