@alloy-js/csharp 0.18.0-dev.5 → 0.18.0-dev.6
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 +8 -2
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +3 -2
- package/dist/src/components/EnumDeclaration.d.ts +2 -2
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/stc/index.d.ts +2 -2
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/modifiers.d.ts +3 -2
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +7 -6
- package/dist/test/class.test.js +52 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/ClassDeclaration.tsx +23 -4
- package/src/components/EnumDeclaration.tsx +2 -2
- package/src/modifiers.ts +22 -21
- package/temp/api.json +370 -176
- package/test/class.test.tsx +40 -10
package/test/class.test.tsx
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
import * as core from "@alloy-js/core";
|
|
2
2
|
import * as coretest from "@alloy-js/core/testing";
|
|
3
|
-
import { expect, it } from "vitest";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
4
|
import * as csharp from "../src/index.js";
|
|
5
|
+
import { ClassDeclaration } from "../src/index.js";
|
|
5
6
|
import * as utils from "./utils.js";
|
|
6
7
|
|
|
7
8
|
it("declares class with no members", () => {
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
public class TestClass;
|
|
16
|
-
}
|
|
9
|
+
expect(
|
|
10
|
+
<utils.TestNamespace>
|
|
11
|
+
<ClassDeclaration name="TestClass" />
|
|
12
|
+
</utils.TestNamespace>,
|
|
13
|
+
).toRenderTo(`
|
|
14
|
+
class TestClass;
|
|
17
15
|
`);
|
|
18
16
|
});
|
|
19
17
|
|
|
18
|
+
describe("modifiers", () => {
|
|
19
|
+
it.each(["public", "private"])("%s", (mod) => {
|
|
20
|
+
expect(
|
|
21
|
+
<utils.TestNamespace>
|
|
22
|
+
<ClassDeclaration {...{ [mod]: true }} name="TestClass" />
|
|
23
|
+
</utils.TestNamespace>,
|
|
24
|
+
).toRenderTo(`
|
|
25
|
+
${mod} class TestClass;
|
|
26
|
+
`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it.each(["partial", "abstract", "static", "sealed"])("%s", (mod) => {
|
|
30
|
+
expect(
|
|
31
|
+
<utils.TestNamespace>
|
|
32
|
+
<ClassDeclaration {...{ [mod]: true }} name="TestClass" />
|
|
33
|
+
</utils.TestNamespace>,
|
|
34
|
+
).toRenderTo(`
|
|
35
|
+
${mod} class TestClass;
|
|
36
|
+
`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("combines modifiers", () => {
|
|
40
|
+
expect(
|
|
41
|
+
<utils.TestNamespace>
|
|
42
|
+
<ClassDeclaration public abstract partial name="TestClass" />
|
|
43
|
+
</utils.TestNamespace>,
|
|
44
|
+
).toRenderTo(`
|
|
45
|
+
public abstract partial class TestClass;
|
|
46
|
+
`);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
20
50
|
it("declares class with some members", () => {
|
|
21
51
|
const res = utils.toSourceText(
|
|
22
52
|
<csharp.ClassDeclaration public name="TestClass">
|