Skip to content

Commit 8b76e8b

Browse files
committed
add or update test code for 'nullable', 'record' and 'init'
1 parent 159fc07 commit 8b76e8b

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
record TestData
2+
{
3+
public string Name { get; init; }
4+
public void Func()
5+
{
6+
}
7+
}
8+
9+
record TestData(string Name);
10+
11+
----------------------------------------------------
12+
13+
[
14+
["keyword", "record"],
15+
["class-name", ["TestData"]],
16+
17+
["punctuation", "{"],
18+
19+
["keyword", "public"],
20+
["return-type", [
21+
["keyword", "string"]
22+
]],
23+
" Name ",
24+
["punctuation", "{"],
25+
["keyword", "get"],
26+
["punctuation", ";"],
27+
["keyword", "init"],
28+
["punctuation", ";"],
29+
["punctuation", "}"],
30+
31+
["keyword", "public"],
32+
["return-type", [
33+
["keyword", "void"]
34+
]],
35+
["function", "Func"],
36+
["punctuation", "("],
37+
["punctuation", ")"],
38+
["punctuation", "{"],
39+
["punctuation", "}"],
40+
41+
["punctuation", "}"],
42+
43+
["keyword", "record"],
44+
["class-name", ["TestData"]],
45+
["punctuation", "("],
46+
["class-name", [
47+
["keyword", "string"]
48+
]],
49+
" Name",
50+
["punctuation", ")"],
51+
["punctuation", ";"]
52+
]

tests/languages/csharp/keyword_feature.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ group
4343
if
4444
implicit
4545
in
46+
init;
4647
int;
4748
interface;
4849
internal
@@ -71,6 +72,7 @@ private
7172
protected
7273
public
7374
readonly
75+
record;
7476
ref
7577
remove
7678
return
@@ -154,6 +156,7 @@ yield
154156
["keyword", "if"],
155157
["keyword", "implicit"],
156158
["keyword", "in"],
159+
["keyword", "init"], ["punctuation", ";"],
157160
["keyword", "int"], ["punctuation", ";"],
158161
["keyword", "interface"], ["punctuation", ";"],
159162
["keyword", "internal"],
@@ -182,6 +185,7 @@ yield
182185
["keyword", "protected"],
183186
["keyword", "public"],
184187
["keyword", "readonly"],
188+
["keyword", "record"], ["punctuation", ";"],
185189
["keyword", "ref"],
186190
["keyword", "remove"],
187191
["keyword", "return"],

tests/languages/csharp/preprocessor_feature.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#endregion
88
#error
99
#line
10+
#nullable
1011
#pragma
1112
#region
1213
#undef
@@ -24,6 +25,7 @@
2425
["preprocessor", ["#", ["directive", "endregion"]]],
2526
["preprocessor", ["#", ["directive", "error"]]],
2627
["preprocessor", ["#", ["directive", "line"]]],
28+
["preprocessor", ["#", ["directive", "nullable"]]],
2729
["preprocessor", ["#", ["directive", "pragma"]]],
2830
["preprocessor", ["#", ["directive", "region"]]],
2931
["preprocessor", ["#", ["directive", "undef"]]],

0 commit comments

Comments
 (0)