@typespec/emitter-framework 0.9.0-dev.7 → 0.9.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/csharp/components/class/declaration.test.js +100 -115
- package/dist/src/csharp/components/{enum-declaration.d.ts → enum/declaration.d.ts} +1 -1
- package/dist/src/csharp/components/enum/declaration.d.ts.map +1 -0
- package/dist/src/csharp/components/{enum-declaration.js → enum/declaration.js} +4 -4
- package/dist/src/csharp/components/enum/declaration.test.d.ts +2 -0
- package/dist/src/csharp/components/enum/declaration.test.d.ts.map +1 -0
- package/dist/src/csharp/components/enum/declaration.test.js +309 -0
- package/dist/src/csharp/components/index.d.ts +1 -1
- package/dist/src/csharp/components/index.js +1 -1
- package/dist/src/csharp/components/property/property.test.js +14 -14
- package/package.json +7 -4
- package/src/csharp/components/class/declaration.test.tsx +106 -168
- package/src/csharp/components/enum/declaration.test.tsx +267 -0
- package/src/csharp/components/{enum-declaration.tsx → enum/declaration.tsx} +4 -4
- package/src/csharp/components/index.ts +1 -1
- package/src/csharp/components/property/property.test.tsx +14 -14
- package/dist/src/csharp/components/enum-declaration.d.ts.map +0 -1
- package/dist/test/csharp/components/enum-declaration.test.d.ts +0 -2
- package/dist/test/csharp/components/enum-declaration.test.d.ts.map +0 -1
- package/dist/test/csharp/components/enum-declaration.test.js +0 -403
- package/dist/test/csharp/test-host.d.ts +0 -11
- package/dist/test/csharp/test-host.d.ts.map +0 -1
- package/dist/test/csharp/test-host.js +0 -32
- package/dist/test/csharp/utils.d.ts +0 -3
- package/dist/test/csharp/utils.d.ts.map +0 -1
- package/dist/test/csharp/utils.js +0 -6
- package/test/csharp/components/enum-declaration.test.tsx +0 -337
- package/test/csharp/test-host.ts +0 -42
- package/test/csharp/utils.ts +0 -8
|
@@ -39,10 +39,10 @@ it("maps prop: string | null to nullable property", async () => {
|
|
|
39
39
|
).toRenderTo(`
|
|
40
40
|
namespace TestNamespace
|
|
41
41
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
class Test
|
|
43
|
+
{
|
|
44
|
+
public required string? Prop1 { get; set; }
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
`);
|
|
48
48
|
});
|
|
@@ -62,11 +62,11 @@ describe("jsonAttributes", () => {
|
|
|
62
62
|
).toRenderTo(`
|
|
63
63
|
namespace TestNamespace
|
|
64
64
|
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
class Test
|
|
66
|
+
{
|
|
67
|
+
[System.Text.Json.JsonPropertyName("prop1")]
|
|
68
|
+
public required string Prop1 { get; set; }
|
|
69
|
+
}
|
|
70
70
|
}
|
|
71
71
|
`);
|
|
72
72
|
});
|
|
@@ -86,11 +86,11 @@ describe("jsonAttributes", () => {
|
|
|
86
86
|
).toRenderTo(`
|
|
87
87
|
namespace TestNamespace
|
|
88
88
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
class Test
|
|
90
|
+
{
|
|
91
|
+
[System.Text.Json.JsonPropertyName("prop_1")]
|
|
92
|
+
public required string Prop1 { get; set; }
|
|
93
|
+
}
|
|
94
94
|
}
|
|
95
95
|
`);
|
|
96
96
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enum-declaration.d.ts","sourceRoot":"","sources":["../../../../src/csharp/components/enum-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAO,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,QAAQ,CA0CrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enum-declaration.test.d.ts","sourceRoot":"","sources":["../../../../test/csharp/components/enum-declaration.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { render } from "@alloy-js/core";
|
|
3
|
-
import { d } from "@alloy-js/core/testing";
|
|
4
|
-
import * as cs from "@alloy-js/csharp";
|
|
5
|
-
import { Namespace, SourceFile } from "@alloy-js/csharp";
|
|
6
|
-
import { beforeEach, it } from "vitest";
|
|
7
|
-
import { Output } from "../../../src/core/index.js";
|
|
8
|
-
import { EnumDeclaration } from "../../../src/csharp/index.js";
|
|
9
|
-
import { createEmitterFrameworkTestRunner } from "../test-host.js";
|
|
10
|
-
import { assertFileContents } from "../utils.js";
|
|
11
|
-
let runner;
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
runner = await createEmitterFrameworkTestRunner();
|
|
14
|
-
});
|
|
15
|
-
it("renders a basic enum declaration", async () => {
|
|
16
|
-
const {
|
|
17
|
-
TestEnum
|
|
18
|
-
} = await runner.compile(`
|
|
19
|
-
@test enum TestEnum {
|
|
20
|
-
Value1;
|
|
21
|
-
Value2;
|
|
22
|
-
Value3;
|
|
23
|
-
}
|
|
24
|
-
`);
|
|
25
|
-
const res = render(_$createComponent(Output, {
|
|
26
|
-
get program() {
|
|
27
|
-
return runner.program;
|
|
28
|
-
},
|
|
29
|
-
get children() {
|
|
30
|
-
return _$createComponent(Namespace, {
|
|
31
|
-
name: "TestNamespace",
|
|
32
|
-
get children() {
|
|
33
|
-
return _$createComponent(SourceFile, {
|
|
34
|
-
path: "test.cs",
|
|
35
|
-
get children() {
|
|
36
|
-
return _$createComponent(EnumDeclaration, {
|
|
37
|
-
type: TestEnum
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
assertFileContents(res, d`
|
|
46
|
-
namespace TestNamespace
|
|
47
|
-
{
|
|
48
|
-
enum TestEnum
|
|
49
|
-
{
|
|
50
|
-
Value1,
|
|
51
|
-
Value2,
|
|
52
|
-
Value3
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`);
|
|
56
|
-
});
|
|
57
|
-
it("renders an empty enum declaration", async () => {
|
|
58
|
-
const {
|
|
59
|
-
TestEnum
|
|
60
|
-
} = await runner.compile(`
|
|
61
|
-
@test enum TestEnum {}
|
|
62
|
-
`);
|
|
63
|
-
const res = render(_$createComponent(Output, {
|
|
64
|
-
get program() {
|
|
65
|
-
return runner.program;
|
|
66
|
-
},
|
|
67
|
-
get children() {
|
|
68
|
-
return _$createComponent(Namespace, {
|
|
69
|
-
name: "TestNamespace",
|
|
70
|
-
get children() {
|
|
71
|
-
return _$createComponent(SourceFile, {
|
|
72
|
-
path: "test.cs",
|
|
73
|
-
get children() {
|
|
74
|
-
return _$createComponent(EnumDeclaration, {
|
|
75
|
-
type: TestEnum
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
assertFileContents(res, d`
|
|
84
|
-
namespace TestNamespace
|
|
85
|
-
{
|
|
86
|
-
enum TestEnum
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
`);
|
|
92
|
-
});
|
|
93
|
-
it("can override enum name", async () => {
|
|
94
|
-
const {
|
|
95
|
-
TestEnum
|
|
96
|
-
} = await runner.compile(`
|
|
97
|
-
@test enum TestEnum {
|
|
98
|
-
Value1;
|
|
99
|
-
Value2;
|
|
100
|
-
}
|
|
101
|
-
`);
|
|
102
|
-
const res = render(_$createComponent(Output, {
|
|
103
|
-
get program() {
|
|
104
|
-
return runner.program;
|
|
105
|
-
},
|
|
106
|
-
get children() {
|
|
107
|
-
return _$createComponent(Namespace, {
|
|
108
|
-
name: "TestNamespace",
|
|
109
|
-
get children() {
|
|
110
|
-
return _$createComponent(SourceFile, {
|
|
111
|
-
path: "test.cs",
|
|
112
|
-
get children() {
|
|
113
|
-
return _$createComponent(EnumDeclaration, {
|
|
114
|
-
type: TestEnum,
|
|
115
|
-
name: "CustomEnumName"
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}));
|
|
123
|
-
assertFileContents(res, d`
|
|
124
|
-
namespace TestNamespace
|
|
125
|
-
{
|
|
126
|
-
enum CustomEnumName
|
|
127
|
-
{
|
|
128
|
-
Value1,
|
|
129
|
-
Value2
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`);
|
|
133
|
-
});
|
|
134
|
-
it("renders an enum with access modifiers", async () => {
|
|
135
|
-
const {
|
|
136
|
-
TestEnum
|
|
137
|
-
} = await runner.compile(`
|
|
138
|
-
@test enum TestEnum {
|
|
139
|
-
Value1;
|
|
140
|
-
Value2;
|
|
141
|
-
}
|
|
142
|
-
`);
|
|
143
|
-
const res = render(_$createComponent(Output, {
|
|
144
|
-
get program() {
|
|
145
|
-
return runner.program;
|
|
146
|
-
},
|
|
147
|
-
get children() {
|
|
148
|
-
return _$createComponent(Namespace, {
|
|
149
|
-
name: "TestNamespace",
|
|
150
|
-
get children() {
|
|
151
|
-
return _$createComponent(SourceFile, {
|
|
152
|
-
path: "test.cs",
|
|
153
|
-
get children() {
|
|
154
|
-
return _$createComponent(EnumDeclaration, {
|
|
155
|
-
type: TestEnum,
|
|
156
|
-
internal: true
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}));
|
|
164
|
-
assertFileContents(res, d`
|
|
165
|
-
namespace TestNamespace
|
|
166
|
-
{
|
|
167
|
-
internal enum TestEnum
|
|
168
|
-
{
|
|
169
|
-
Value1,
|
|
170
|
-
Value2
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
`);
|
|
174
|
-
});
|
|
175
|
-
it("renders enum with C# naming conventions", async () => {
|
|
176
|
-
const {
|
|
177
|
-
TestEnum
|
|
178
|
-
} = await runner.compile(`
|
|
179
|
-
@test enum TestEnum {
|
|
180
|
-
value_one;
|
|
181
|
-
value_two;
|
|
182
|
-
value_three;
|
|
183
|
-
}
|
|
184
|
-
`);
|
|
185
|
-
const res = render(_$createComponent(Output, {
|
|
186
|
-
get program() {
|
|
187
|
-
return runner.program;
|
|
188
|
-
},
|
|
189
|
-
get namePolicy() {
|
|
190
|
-
return cs.createCSharpNamePolicy();
|
|
191
|
-
},
|
|
192
|
-
get children() {
|
|
193
|
-
return _$createComponent(Namespace, {
|
|
194
|
-
name: "TestNamespace",
|
|
195
|
-
get children() {
|
|
196
|
-
return _$createComponent(SourceFile, {
|
|
197
|
-
path: "test.cs",
|
|
198
|
-
get children() {
|
|
199
|
-
return _$createComponent(EnumDeclaration, {
|
|
200
|
-
type: TestEnum
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}));
|
|
208
|
-
assertFileContents(res, d`
|
|
209
|
-
namespace TestNamespace
|
|
210
|
-
{
|
|
211
|
-
enum TestEnum
|
|
212
|
-
{
|
|
213
|
-
ValueOne,
|
|
214
|
-
ValueTwo,
|
|
215
|
-
ValueThree
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
`);
|
|
219
|
-
});
|
|
220
|
-
it("renders enum with single value", async () => {
|
|
221
|
-
const {
|
|
222
|
-
TestEnum
|
|
223
|
-
} = await runner.compile(`
|
|
224
|
-
@test enum TestEnum {
|
|
225
|
-
OnlyValue;
|
|
226
|
-
}
|
|
227
|
-
`);
|
|
228
|
-
const res = render(_$createComponent(Output, {
|
|
229
|
-
get program() {
|
|
230
|
-
return runner.program;
|
|
231
|
-
},
|
|
232
|
-
get children() {
|
|
233
|
-
return _$createComponent(Namespace, {
|
|
234
|
-
name: "TestNamespace",
|
|
235
|
-
get children() {
|
|
236
|
-
return _$createComponent(SourceFile, {
|
|
237
|
-
path: "test.cs",
|
|
238
|
-
get children() {
|
|
239
|
-
return _$createComponent(EnumDeclaration, {
|
|
240
|
-
type: TestEnum
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}));
|
|
248
|
-
assertFileContents(res, d`
|
|
249
|
-
namespace TestNamespace
|
|
250
|
-
{
|
|
251
|
-
enum TestEnum
|
|
252
|
-
{
|
|
253
|
-
OnlyValue
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
`);
|
|
257
|
-
});
|
|
258
|
-
it("renders enum with numeric-like member names", async () => {
|
|
259
|
-
const {
|
|
260
|
-
TestEnum
|
|
261
|
-
} = await runner.compile(`
|
|
262
|
-
@test enum TestEnum {
|
|
263
|
-
Value0;
|
|
264
|
-
Value1;
|
|
265
|
-
Value10;
|
|
266
|
-
Value100;
|
|
267
|
-
}
|
|
268
|
-
`);
|
|
269
|
-
const res = render(_$createComponent(Output, {
|
|
270
|
-
get program() {
|
|
271
|
-
return runner.program;
|
|
272
|
-
},
|
|
273
|
-
get children() {
|
|
274
|
-
return _$createComponent(Namespace, {
|
|
275
|
-
name: "TestNamespace",
|
|
276
|
-
get children() {
|
|
277
|
-
return _$createComponent(SourceFile, {
|
|
278
|
-
path: "test.cs",
|
|
279
|
-
get children() {
|
|
280
|
-
return _$createComponent(EnumDeclaration, {
|
|
281
|
-
type: TestEnum
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}));
|
|
289
|
-
assertFileContents(res, d`
|
|
290
|
-
namespace TestNamespace
|
|
291
|
-
{
|
|
292
|
-
enum TestEnum
|
|
293
|
-
{
|
|
294
|
-
Value0,
|
|
295
|
-
Value1,
|
|
296
|
-
Value10,
|
|
297
|
-
Value100
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
`);
|
|
301
|
-
});
|
|
302
|
-
it("renders multiple enums in the same namespace", async () => {
|
|
303
|
-
const {
|
|
304
|
-
TestEnum1,
|
|
305
|
-
TestEnum2
|
|
306
|
-
} = await runner.compile(`
|
|
307
|
-
@test enum TestEnum1 {
|
|
308
|
-
Value1;
|
|
309
|
-
Value2;
|
|
310
|
-
}
|
|
311
|
-
@test enum TestEnum2 {
|
|
312
|
-
OptionA;
|
|
313
|
-
OptionB;
|
|
314
|
-
OptionC;
|
|
315
|
-
}
|
|
316
|
-
`);
|
|
317
|
-
const res = render(_$createComponent(Output, {
|
|
318
|
-
get program() {
|
|
319
|
-
return runner.program;
|
|
320
|
-
},
|
|
321
|
-
get children() {
|
|
322
|
-
return _$createComponent(Namespace, {
|
|
323
|
-
name: "TestNamespace",
|
|
324
|
-
get children() {
|
|
325
|
-
return _$createComponent(SourceFile, {
|
|
326
|
-
path: "test.cs",
|
|
327
|
-
get children() {
|
|
328
|
-
return [_$createComponent(EnumDeclaration, {
|
|
329
|
-
type: TestEnum1
|
|
330
|
-
}), _$createIntrinsic("hbr", {}), _$createComponent(EnumDeclaration, {
|
|
331
|
-
type: TestEnum2
|
|
332
|
-
})];
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}));
|
|
339
|
-
assertFileContents(res, d`
|
|
340
|
-
namespace TestNamespace
|
|
341
|
-
{
|
|
342
|
-
enum TestEnum1
|
|
343
|
-
{
|
|
344
|
-
Value1,
|
|
345
|
-
Value2
|
|
346
|
-
}
|
|
347
|
-
enum TestEnum2
|
|
348
|
-
{
|
|
349
|
-
OptionA,
|
|
350
|
-
OptionB,
|
|
351
|
-
OptionC
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
`);
|
|
355
|
-
});
|
|
356
|
-
it("renders an enum with doc comments", async () => {
|
|
357
|
-
const {
|
|
358
|
-
TestEnum
|
|
359
|
-
} = await runner.compile(`
|
|
360
|
-
@test enum TestEnum {
|
|
361
|
-
@doc("This is value one")
|
|
362
|
-
Value1;
|
|
363
|
-
/** This is value two */
|
|
364
|
-
Value2;
|
|
365
|
-
}
|
|
366
|
-
`);
|
|
367
|
-
const res = render(_$createComponent(Output, {
|
|
368
|
-
get program() {
|
|
369
|
-
return runner.program;
|
|
370
|
-
},
|
|
371
|
-
get children() {
|
|
372
|
-
return _$createComponent(Namespace, {
|
|
373
|
-
name: "TestNamespace",
|
|
374
|
-
get children() {
|
|
375
|
-
return _$createComponent(SourceFile, {
|
|
376
|
-
path: "test.cs",
|
|
377
|
-
get children() {
|
|
378
|
-
return _$createComponent(EnumDeclaration, {
|
|
379
|
-
type: TestEnum
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
}));
|
|
387
|
-
assertFileContents(res, d`
|
|
388
|
-
namespace TestNamespace
|
|
389
|
-
{
|
|
390
|
-
enum TestEnum
|
|
391
|
-
{
|
|
392
|
-
/// <summary>
|
|
393
|
-
/// This is value one
|
|
394
|
-
/// </summary>
|
|
395
|
-
Value1,
|
|
396
|
-
/// <summary>
|
|
397
|
-
/// This is value two
|
|
398
|
-
/// </summary>
|
|
399
|
-
Value2
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
`);
|
|
403
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Program } from "@typespec/compiler";
|
|
2
|
-
export declare function createTypespecCliTestHost(options?: {
|
|
3
|
-
libraries: "Http"[];
|
|
4
|
-
}): Promise<import("@typespec/compiler/testing").TestHost>;
|
|
5
|
-
export declare function createEmitterFrameworkTestRunner(options?: {
|
|
6
|
-
autoUsings?: string[];
|
|
7
|
-
}): Promise<import("@typespec/compiler/testing").BasicTestRunner>;
|
|
8
|
-
export declare function getProgram(code: string, options?: {
|
|
9
|
-
libraries: "Http"[];
|
|
10
|
-
}): Promise<Program>;
|
|
11
|
-
//# sourceMappingURL=test-host.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-host.d.ts","sourceRoot":"","sources":["../../../test/csharp/test-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AASlD,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE;IAAE,SAAS,EAAE,MAAM,EAAE,CAAA;CAAsB,0DASrD;AAED,wBAAsB,gCAAgC,CAAC,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,iEAK7F;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,SAAS,EAAE,MAAM,EAAE,CAAA;CAAsB,GACnD,OAAO,CAAC,OAAO,CAAC,CAUlB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createTestHost, createTestWrapper, expectDiagnosticEmpty } from "@typespec/compiler/testing";
|
|
2
|
-
import { HttpTestLibrary } from "@typespec/http/testing";
|
|
3
|
-
export async function createTypespecCliTestHost(options = {
|
|
4
|
-
libraries: []
|
|
5
|
-
}) {
|
|
6
|
-
const libraries = [];
|
|
7
|
-
if (options.libraries.includes("Http")) {
|
|
8
|
-
libraries.push(HttpTestLibrary);
|
|
9
|
-
}
|
|
10
|
-
return createTestHost({
|
|
11
|
-
libraries
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export async function createEmitterFrameworkTestRunner(options = {}) {
|
|
15
|
-
const host = await createTypespecCliTestHost();
|
|
16
|
-
return createTestWrapper(host, {
|
|
17
|
-
autoUsings: options.autoUsings
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
export async function getProgram(code, options = {
|
|
21
|
-
libraries: []
|
|
22
|
-
}) {
|
|
23
|
-
const host = await createTypespecCliTestHost(options);
|
|
24
|
-
const wrapper = createTestWrapper(host, {
|
|
25
|
-
compilerOptions: {
|
|
26
|
-
noEmit: true
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const [_, diagnostics] = await wrapper.compileAndDiagnose(code);
|
|
30
|
-
expectDiagnosticEmpty(diagnostics);
|
|
31
|
-
return wrapper.program;
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../test/csharp/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,QAIxE"}
|