@alloy-js/csharp 0.19.0-dev.2 → 0.19.0-dev.5
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/components/ClassDeclaration.d.ts +0 -16
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +1 -74
- package/dist/src/components/constructor/constructor.d.ts +17 -0
- package/dist/src/components/constructor/constructor.d.ts.map +1 -0
- package/dist/src/components/constructor/constructor.js +47 -0
- package/dist/src/components/constructor/constructor.test.d.ts +2 -0
- package/dist/src/components/constructor/constructor.test.d.ts.map +1 -0
- package/dist/src/components/constructor/constructor.test.js +54 -0
- package/dist/src/components/field/field.d.ts +12 -0
- package/dist/src/components/field/field.d.ts.map +1 -0
- package/dist/src/components/field/field.js +34 -0
- package/dist/src/components/field/field.test.d.ts +2 -0
- package/dist/src/components/field/field.test.d.ts.map +1 -0
- package/dist/src/components/field/field.test.js +37 -0
- package/dist/src/components/index.d.ts +3 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +3 -1
- package/dist/src/components/{ClassMethod.d.ts → method/method.d.ts} +8 -8
- package/dist/src/components/method/method.d.ts.map +1 -0
- package/dist/src/components/{ClassMethod.js → method/method.js} +12 -12
- package/dist/src/components/method/method.test.d.ts +2 -0
- package/dist/src/components/method/method.test.d.ts.map +1 -0
- package/dist/{test/class-method.test.js → src/components/method/method.test.js} +11 -11
- package/dist/src/components/stc/index.d.ts +3 -3
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +3 -3
- package/dist/src/components/struct/declaration.d.ts +2 -0
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +6 -2
- package/dist/src/components/struct/declaration.test.js +85 -1
- package/dist/test/class-declaration.test.js +14 -12
- package/dist/test/using.test.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/ClassDeclaration.tsx +2 -84
- package/src/components/constructor/constructor.test.tsx +41 -0
- package/src/components/constructor/constructor.tsx +67 -0
- package/src/components/field/field.test.tsx +24 -0
- package/src/components/field/field.tsx +50 -0
- package/src/components/index.ts +3 -1
- package/{test/class-method.test.tsx → src/components/method/method.test.tsx} +12 -17
- package/src/components/{ClassMethod.tsx → method/method.tsx} +21 -18
- package/src/components/stc/index.ts +3 -3
- package/src/components/struct/declaration.test.tsx +63 -1
- package/src/components/struct/declaration.tsx +11 -0
- package/temp/api.json +2148 -2153
- package/test/class-declaration.test.tsx +16 -33
- package/test/using.test.tsx +1 -1
- package/dist/src/components/ClassMethod.d.ts.map +0 -1
- package/dist/test/class-method.test.d.ts +0 -2
- package/dist/test/class-method.test.d.ts.map +0 -1
|
@@ -3,14 +3,11 @@ import { List, refkey } from "@alloy-js/core";
|
|
|
3
3
|
import * as coretest from "@alloy-js/core/testing";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import { Attribute } from "../src/components/attributes/attributes.jsx";
|
|
6
|
+
import { Field } from "../src/components/field/field.jsx";
|
|
7
|
+
import { Constructor } from "../src/components/stc/index.js";
|
|
6
8
|
import { TypeParameterProps } from "../src/components/type-parameters/type-parameter.jsx";
|
|
7
9
|
import * as csharp from "../src/index.js";
|
|
8
|
-
import {
|
|
9
|
-
ClassDeclaration,
|
|
10
|
-
ClassMember,
|
|
11
|
-
Property,
|
|
12
|
-
SourceFile,
|
|
13
|
-
} from "../src/index.js";
|
|
10
|
+
import { ClassDeclaration, Property, SourceFile } from "../src/index.js";
|
|
14
11
|
import * as utils from "./utils.jsx";
|
|
15
12
|
|
|
16
13
|
it("declares class with no members", () => {
|
|
@@ -98,8 +95,8 @@ it("declares class with some members", () => {
|
|
|
98
95
|
const res = utils.toSourceText(
|
|
99
96
|
<csharp.ClassDeclaration public name="TestClass">
|
|
100
97
|
<core.StatementList>
|
|
101
|
-
<
|
|
102
|
-
<
|
|
98
|
+
<Field public name="MemberOne" type="string" />
|
|
99
|
+
<Field private name="MemberTwo" type="int" />
|
|
103
100
|
</core.StatementList>
|
|
104
101
|
</csharp.ClassDeclaration>,
|
|
105
102
|
);
|
|
@@ -120,8 +117,8 @@ it("declares class with some methods", () => {
|
|
|
120
117
|
const res = utils.toSourceText(
|
|
121
118
|
<csharp.ClassDeclaration public name="TestClass">
|
|
122
119
|
<core.List>
|
|
123
|
-
<csharp.
|
|
124
|
-
<csharp.
|
|
120
|
+
<csharp.Method public name="MethodOne" />
|
|
121
|
+
<csharp.Method private virtual name="MethodTwo" />
|
|
125
122
|
</core.List>
|
|
126
123
|
</csharp.ClassDeclaration>,
|
|
127
124
|
);
|
|
@@ -182,21 +179,17 @@ it("uses refkeys for members, params, and return type", () => {
|
|
|
182
179
|
/>
|
|
183
180
|
<hbr />
|
|
184
181
|
<csharp.ClassDeclaration public name="TestClass">
|
|
185
|
-
<
|
|
186
|
-
private
|
|
187
|
-
name="MemberOne"
|
|
188
|
-
type={enumTypeRefkey}
|
|
189
|
-
/>
|
|
182
|
+
<Field private name="MemberOne" type={enumTypeRefkey} />
|
|
190
183
|
;
|
|
191
184
|
<hbr />
|
|
192
|
-
<csharp.
|
|
185
|
+
<csharp.Method
|
|
193
186
|
public
|
|
194
187
|
name="MethodOne"
|
|
195
188
|
parameters={params}
|
|
196
189
|
returns={testResultTypeRefkey}
|
|
197
190
|
>
|
|
198
191
|
return new {testResultTypeRefkey}();
|
|
199
|
-
</csharp.
|
|
192
|
+
</csharp.Method>
|
|
200
193
|
</csharp.ClassDeclaration>
|
|
201
194
|
</csharp.SourceFile>
|
|
202
195
|
</csharp.Namespace>
|
|
@@ -314,7 +307,7 @@ it("declares class with invalid members", () => {
|
|
|
314
307
|
it("declares class with constructor", () => {
|
|
315
308
|
const res = utils.toSourceText(
|
|
316
309
|
<csharp.ClassDeclaration public name="TestClass">
|
|
317
|
-
<
|
|
310
|
+
<Constructor public />
|
|
318
311
|
</csharp.ClassDeclaration>,
|
|
319
312
|
);
|
|
320
313
|
|
|
@@ -350,24 +343,14 @@ it("declares class with constructor params and assigns values to fields", () =>
|
|
|
350
343
|
|
|
351
344
|
const res = utils.toSourceText(
|
|
352
345
|
<csharp.ClassDeclaration public name="TestClass">
|
|
353
|
-
<
|
|
354
|
-
private
|
|
355
|
-
name="name"
|
|
356
|
-
type="string"
|
|
357
|
-
refkey={thisNameRefkey}
|
|
358
|
-
/>
|
|
346
|
+
<Field private name="name" type="string" refkey={thisNameRefkey} />
|
|
359
347
|
;<hbr />
|
|
360
|
-
<
|
|
361
|
-
private
|
|
362
|
-
name="size"
|
|
363
|
-
type="int"
|
|
364
|
-
refkey={thisSizeRefkey}
|
|
365
|
-
/>
|
|
348
|
+
<Field private name="size" type="int" refkey={thisSizeRefkey} />
|
|
366
349
|
;<hbr />
|
|
367
|
-
<
|
|
350
|
+
<Constructor public parameters={ctorParams}>
|
|
368
351
|
{thisNameRefkey} = {paramNameRefkey};<hbr />
|
|
369
352
|
{thisSizeRefkey} = {paramSizeRefkey};
|
|
370
|
-
</
|
|
353
|
+
</Constructor>
|
|
371
354
|
</csharp.ClassDeclaration>,
|
|
372
355
|
);
|
|
373
356
|
|
|
@@ -405,7 +388,7 @@ it("supports class member doc comments", () => {
|
|
|
405
388
|
expect(
|
|
406
389
|
<utils.TestNamespace>
|
|
407
390
|
<ClassDeclaration name="Test" doc="This is a test">
|
|
408
|
-
<
|
|
391
|
+
<Field name="Member" public type="int" doc="This is a member" />
|
|
409
392
|
</ClassDeclaration>
|
|
410
393
|
</utils.TestNamespace>,
|
|
411
394
|
).toRenderTo(`
|
package/test/using.test.tsx
CHANGED
|
@@ -73,7 +73,7 @@ it("adds using statement across namespaces", () => {
|
|
|
73
73
|
<csharp.Namespace name="Client">
|
|
74
74
|
<csharp.SourceFile path="Client.cs" using={["System"]}>
|
|
75
75
|
<csharp.ClassDeclaration public name="Client">
|
|
76
|
-
<csharp.
|
|
76
|
+
<csharp.Method
|
|
77
77
|
public
|
|
78
78
|
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