Skip to content

Commit 3ec2e66

Browse files
committed
Add tests for computed property names
1 parent caae509 commit 3ec2e66

File tree

13 files changed

+375
-108
lines changed

13 files changed

+375
-108
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/test/converter/access/specs.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
"kind": 1024,
5858
"kindString": "Property",
5959
"flags": {
60-
"isExported": true,
61-
"isProtected": true
60+
"isProtected": true,
61+
"isExported": true
6262
},
6363
"comment": {
6464
"shortText": "A variable that is made protected via comment."
@@ -116,8 +116,8 @@
116116
"kind": 2048,
117117
"kindString": "Method",
118118
"flags": {
119-
"isExported": true,
120-
"isProtected": true
119+
"isProtected": true,
120+
"isExported": true
121121
},
122122
"signatures": [
123123
{
@@ -204,8 +204,8 @@
204204
"kind": 32,
205205
"kindString": "Variable",
206206
"flags": {
207-
"isExported": true,
208207
"isProtected": true,
208+
"isExported": true,
209209
"isConst": true
210210
},
211211
"comment": {
@@ -265,8 +265,8 @@
265265
"kind": 64,
266266
"kindString": "Function",
267267
"flags": {
268-
"isExported": true,
269-
"isProtected": true
268+
"isProtected": true,
269+
"isExported": true
270270
},
271271
"signatures": [
272272
{

src/test/converter/array/specs.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
},
126126
{
127127
"id": 210,
128-
"name": "__@iterator",
128+
"name": "[Symbol.iterator]",
129129
"kind": 2048,
130130
"kindString": "Method",
131131
"flags": {
@@ -134,7 +134,7 @@
134134
"signatures": [
135135
{
136136
"id": 211,
137-
"name": "__@iterator",
137+
"name": "[Symbol.iterator]",
138138
"kind": 4096,
139139
"kindString": "Call signature",
140140
"flags": {},
@@ -172,7 +172,7 @@
172172
},
173173
{
174174
"id": 218,
175-
"name": "__@unscopables",
175+
"name": "[Symbol.unscopables]",
176176
"kind": 2048,
177177
"kindString": "Method",
178178
"flags": {
@@ -181,7 +181,7 @@
181181
"signatures": [
182182
{
183183
"id": 219,
184-
"name": "__@unscopables",
184+
"name": "[Symbol.unscopables]",
185185
"kind": 4096,
186186
"kindString": "Call signature",
187187
"flags": {},

src/test/converter/class/class.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,12 @@ abstract class NotExportedClass {
109109
a + b;
110110
}
111111
}
112+
113+
const x = 'literal';
114+
115+
export class ComputedNames {
116+
[Symbol.toStringTag] = 'computed';
117+
[x] = true;
118+
['literal2'] = true;
119+
y = false;
120+
}

src/test/converter/class/specs-without-exported.json

Lines changed: 139 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,120 @@
1414
},
1515
"originalName": "%BASE%/class/class.ts",
1616
"children": [
17+
{
18+
"id": 44,
19+
"name": "ComputedNames",
20+
"kind": 128,
21+
"kindString": "Class",
22+
"flags": {
23+
"isExported": true
24+
},
25+
"children": [
26+
{
27+
"id": 45,
28+
"name": "[Symbol.toStringTag]",
29+
"kind": 1024,
30+
"kindString": "Property",
31+
"flags": {
32+
"isExported": true
33+
},
34+
"sources": [
35+
{
36+
"fileName": "class.ts",
37+
"line": 116,
38+
"character": 24
39+
}
40+
],
41+
"type": {
42+
"type": "intrinsic",
43+
"name": "string"
44+
},
45+
"defaultValue": "\"computed\""
46+
},
47+
{
48+
"id": 46,
49+
"name": "[x]",
50+
"kind": 1024,
51+
"kindString": "Property",
52+
"flags": {
53+
"isExported": true
54+
},
55+
"sources": [
56+
{
57+
"fileName": "class.ts",
58+
"line": 117,
59+
"character": 7
60+
}
61+
],
62+
"type": {
63+
"type": "intrinsic",
64+
"name": "boolean"
65+
},
66+
"defaultValue": "true"
67+
},
68+
{
69+
"id": 47,
70+
"name": "literal2",
71+
"kind": 1024,
72+
"kindString": "Property",
73+
"flags": {
74+
"isExported": true
75+
},
76+
"sources": [
77+
{
78+
"fileName": "class.ts",
79+
"line": 118,
80+
"character": 16
81+
}
82+
],
83+
"type": {
84+
"type": "intrinsic",
85+
"name": "boolean"
86+
},
87+
"defaultValue": "true"
88+
},
89+
{
90+
"id": 48,
91+
"name": "y",
92+
"kind": 1024,
93+
"kindString": "Property",
94+
"flags": {
95+
"isExported": true
96+
},
97+
"sources": [
98+
{
99+
"fileName": "class.ts",
100+
"line": 119,
101+
"character": 5
102+
}
103+
],
104+
"type": {
105+
"type": "intrinsic",
106+
"name": "boolean"
107+
},
108+
"defaultValue": "false"
109+
}
110+
],
111+
"groups": [
112+
{
113+
"title": "Properties",
114+
"kind": 1024,
115+
"children": [
116+
45,
117+
46,
118+
47,
119+
48
120+
]
121+
}
122+
],
123+
"sources": [
124+
{
125+
"fileName": "class.ts",
126+
"line": 115,
127+
"character": 26
128+
}
129+
]
130+
},
17131
{
18132
"id": 34,
19133
"name": "TestAbstractClass",
@@ -51,8 +165,8 @@
51165
"kind": 2048,
52166
"kindString": "Method",
53167
"flags": {
54-
"isExported": true,
55168
"isProtected": true,
169+
"isExported": true,
56170
"isAbstract": true
57171
},
58172
"signatures": [
@@ -148,8 +262,8 @@
148262
"kind": 2048,
149263
"kindString": "Method",
150264
"flags": {
151-
"isExported": true,
152-
"isProtected": true
265+
"isProtected": true,
266+
"isExported": true
153267
},
154268
"signatures": [
155269
{
@@ -302,8 +416,8 @@
302416
"kind": 1024,
303417
"kindString": "Property",
304418
"flags": {
305-
"isExported": true,
306-
"isPublic": true
419+
"isPublic": true,
420+
"isExported": true
307421
},
308422
"comment": {
309423
"shortText": "publicProperty short text."
@@ -384,8 +498,8 @@
384498
"kind": 2048,
385499
"kindString": "Method",
386500
"flags": {
387-
"isExported": true,
388-
"isProtected": true
501+
"isProtected": true,
502+
"isExported": true
389503
},
390504
"signatures": [
391505
{
@@ -417,8 +531,8 @@
417531
"kind": 2048,
418532
"kindString": "Method",
419533
"flags": {
420-
"isExported": true,
421-
"isPublic": true
534+
"isPublic": true,
535+
"isExported": true
422536
},
423537
"signatures": [
424538
{
@@ -641,8 +755,8 @@
641755
"kindString": "Property",
642756
"flags": {
643757
"isPrivate": true,
644-
"isConstructorProperty": true,
645-
"isExported": true
758+
"isExported": true,
759+
"isConstructorProperty": true
646760
},
647761
"comment": {
648762
"shortText": "Private string property"
@@ -665,9 +779,9 @@
665779
"kind": 1024,
666780
"kindString": "Property",
667781
"flags": {
668-
"isConstructorProperty": true,
782+
"isPublic": true,
669783
"isExported": true,
670-
"isPublic": true
784+
"isConstructorProperty": true
671785
},
672786
"comment": {
673787
"shortText": "Public number property"
@@ -690,9 +804,9 @@
690804
"kind": 1024,
691805
"kindString": "Property",
692806
"flags": {
693-
"isConstructorProperty": true,
807+
"isPublic": true,
694808
"isExported": true,
695-
"isPublic": true
809+
"isConstructorProperty": true
696810
},
697811
"comment": {
698812
"shortText": "Public implicit any property\n"
@@ -715,8 +829,8 @@
715829
"kind": 1024,
716830
"kindString": "Property",
717831
"flags": {
718-
"isExported": true,
719-
"isPublic": true
832+
"isPublic": true,
833+
"isExported": true
720834
},
721835
"comment": {
722836
"shortText": "publicProperty short text."
@@ -806,8 +920,8 @@
806920
"kind": 2048,
807921
"kindString": "Method",
808922
"flags": {
809-
"isExported": true,
810-
"isProtected": true
923+
"isProtected": true,
924+
"isExported": true
811925
},
812926
"signatures": [
813927
{
@@ -849,8 +963,8 @@
849963
"kind": 2048,
850964
"kindString": "Method",
851965
"flags": {
852-
"isExported": true,
853-
"isPublic": true
966+
"isPublic": true,
967+
"isExported": true
854968
},
855969
"signatures": [
856970
{
@@ -887,7 +1001,7 @@
8871001
}
8881002
},
8891003
{
890-
"id": 44,
1004+
"id": 49,
8911005
"name": "staticMergedMethod",
8921006
"kind": 2048,
8931007
"kindString": "Method",
@@ -897,7 +1011,7 @@
8971011
},
8981012
"signatures": [
8991013
{
900-
"id": 45,
1014+
"id": 50,
9011015
"name": "staticMergedMethod",
9021016
"kind": 4096,
9031017
"kindString": "Call signature",
@@ -989,7 +1103,7 @@
9891103
42,
9901104
19,
9911105
17,
992-
44,
1106+
49,
9931107
32
9941108
]
9951109
}
@@ -1025,6 +1139,7 @@
10251139
"title": "Classes",
10261140
"kind": 128,
10271141
"children": [
1142+
44,
10281143
34,
10291144
38,
10301145
2,

0 commit comments

Comments
 (0)