@alloy-js/csharp 0.19.0-dev.8 → 0.19.0-dev.9
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/test/class-declaration.test.js +2 -1
- package/dist/test/enum.test.js +4 -5
- package/dist/test/namespace.test.js +28 -29
- package/dist/test/sourcefile.test.js +15 -14
- package/dist/test/using.test.js +29 -26
- package/dist/test/utils.d.ts +1 -1
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/class-declaration.test.tsx +2 -1
- package/test/enum.test.tsx +4 -5
- package/test/namespace.test.tsx +28 -32
- package/test/project-directory.test.tsx +12 -6
- package/test/sourcefile.test.tsx +15 -15
- package/test/using.test.tsx +29 -27
- package/test/utils.tsx +2 -2
|
@@ -9,6 +9,7 @@ import { Constructor } from "../src/components/stc/index.js";
|
|
|
9
9
|
import * as csharp from "../src/index.js";
|
|
10
10
|
import { ClassDeclaration, Property, SourceFile } from "../src/index.js";
|
|
11
11
|
import * as utils from "./utils.js";
|
|
12
|
+
import { findFile } from "./utils.js";
|
|
12
13
|
it("declares class with no members", () => {
|
|
13
14
|
expect(_$createComponent(utils.TestNamespace, {
|
|
14
15
|
get children() {
|
|
@@ -234,7 +235,7 @@ it("uses refkeys for members, params, and return type", () => {
|
|
|
234
235
|
});
|
|
235
236
|
}
|
|
236
237
|
}));
|
|
237
|
-
expect(res.
|
|
238
|
+
expect(findFile(res, "Test.cs").contents).toBe(coretest.d`
|
|
238
239
|
namespace TestCode
|
|
239
240
|
{
|
|
240
241
|
public enum TestEnum
|
package/dist/test/enum.test.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as coretest from "@alloy-js/core/testing";
|
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
6
|
import * as utils from "./utils.js";
|
|
7
|
+
import { findFile } from "./utils.js";
|
|
7
8
|
it("declares enum with no members", () => {
|
|
8
9
|
const res = utils.toSourceText(_$createComponent(csharp.EnumDeclaration, {
|
|
9
10
|
"public": true,
|
|
@@ -92,7 +93,7 @@ it("can reference things by refkey", () => {
|
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}));
|
|
95
|
-
expect(res.
|
|
96
|
+
expect(findFile(res, "Test.cs").contents).toBe(coretest.d`
|
|
96
97
|
namespace TestCode
|
|
97
98
|
{
|
|
98
99
|
public enum TestEnum
|
|
@@ -150,8 +151,7 @@ it("can reference things by refkey across files", () => {
|
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
}));
|
|
153
|
-
expect(res.contents
|
|
154
|
-
expect(res.contents[0].contents).toBe(coretest.d`
|
|
154
|
+
expect(findFile(res, "Test.cs").contents).toBe(coretest.d`
|
|
155
155
|
namespace TestCode
|
|
156
156
|
{
|
|
157
157
|
public enum TestEnum
|
|
@@ -163,8 +163,7 @@ it("can reference things by refkey across files", () => {
|
|
|
163
163
|
OtherEnum.Bar;
|
|
164
164
|
}
|
|
165
165
|
`);
|
|
166
|
-
expect(res.contents
|
|
167
|
-
expect(res.contents[1].contents).toBe(coretest.d`
|
|
166
|
+
expect(findFile(res, "Other.cs").contents).toBe(coretest.d`
|
|
168
167
|
namespace TestCode
|
|
169
168
|
{
|
|
170
169
|
public enum OtherEnum
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import * as core from "@alloy-js/core";
|
|
3
3
|
import * as coretest from "@alloy-js/core/testing";
|
|
4
|
-
import {
|
|
4
|
+
import { it } from "vitest";
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
|
+
import { assertFileContents } from "./utils.js";
|
|
6
7
|
it("defines multiple namespaces and source files with unique content", () => {
|
|
7
8
|
const res = core.render(_$createComponent(core.Output, {
|
|
8
9
|
get children() {
|
|
@@ -51,32 +52,30 @@ it("defines multiple namespaces and source files with unique content", () => {
|
|
|
51
52
|
})];
|
|
52
53
|
}
|
|
53
54
|
}));
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
`);
|
|
55
|
+
assertFileContents(res, {
|
|
56
|
+
"Model1.cs": coretest.d`
|
|
57
|
+
namespace Namespace1
|
|
58
|
+
{
|
|
59
|
+
public class Model1;
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
"Model2.cs": coretest.d`
|
|
63
|
+
namespace Namespace1
|
|
64
|
+
{
|
|
65
|
+
public class Model2;
|
|
66
|
+
}
|
|
67
|
+
`,
|
|
68
|
+
"Model3.cs": coretest.d`
|
|
69
|
+
namespace Namespace2
|
|
70
|
+
{
|
|
71
|
+
public class Model3;
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
"Model4.cs": coretest.d`
|
|
75
|
+
namespace Namespace2
|
|
76
|
+
{
|
|
77
|
+
public class Model4;
|
|
78
|
+
}
|
|
79
|
+
`
|
|
80
|
+
});
|
|
82
81
|
});
|
|
@@ -3,6 +3,7 @@ import * as core from "@alloy-js/core";
|
|
|
3
3
|
import * as coretest from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
|
+
import { assertFileContents } from "./utils.js";
|
|
6
7
|
it("defines multiple source files with unique content", () => {
|
|
7
8
|
const res = core.render(_$createComponent(core.Output, {
|
|
8
9
|
get children() {
|
|
@@ -30,20 +31,20 @@ it("defines multiple source files with unique content", () => {
|
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
}));
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
assertFileContents(res, {
|
|
35
|
+
"Test1.cs": coretest.d`
|
|
36
|
+
namespace TestCode
|
|
37
|
+
{
|
|
38
|
+
public class TestClass1;
|
|
39
|
+
}
|
|
40
|
+
`,
|
|
41
|
+
"Test2.cs": coretest.d`
|
|
42
|
+
namespace TestCode
|
|
43
|
+
{
|
|
44
|
+
public class TestClass2;
|
|
45
|
+
}
|
|
46
|
+
`
|
|
47
|
+
});
|
|
47
48
|
});
|
|
48
49
|
it("throws when declaring a source file outside a namespace", () => {
|
|
49
50
|
const decl = _$createComponent(core.Output, {
|
package/dist/test/using.test.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as core from "@alloy-js/core";
|
|
|
3
3
|
import * as coretest from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
|
+
import { assertFileContents, findFile } from "./utils.js";
|
|
6
7
|
it("uses a single namespace", () => {
|
|
7
8
|
const res = core.render(_$createComponent(core.Output, {
|
|
8
9
|
get children() {
|
|
@@ -17,7 +18,7 @@ it("uses a single namespace", () => {
|
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
}));
|
|
20
|
-
expect(res.
|
|
21
|
+
expect(findFile(res, "Test1.cs").contents).toBe(coretest.d`
|
|
21
22
|
using Foo;
|
|
22
23
|
|
|
23
24
|
namespace TestCode {}
|
|
@@ -37,7 +38,7 @@ it("uses multiple namespaces", () => {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
}));
|
|
40
|
-
expect(res.
|
|
41
|
+
expect(findFile(res, "Test1.cs").contents).toBe(coretest.d`
|
|
41
42
|
using Bar.Baz;
|
|
42
43
|
using Foo;
|
|
43
44
|
|
|
@@ -111,29 +112,31 @@ it("adds using statement across namespaces", () => {
|
|
|
111
112
|
})];
|
|
112
113
|
}
|
|
113
114
|
}));
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
assertFileContents(res, {
|
|
116
|
+
"Models.cs": coretest.d`
|
|
117
|
+
namespace Models
|
|
118
|
+
{
|
|
119
|
+
public class Input;
|
|
120
|
+
public class Output;
|
|
121
|
+
public enum TestEnum
|
|
122
|
+
{
|
|
123
|
+
One,
|
|
124
|
+
Two
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
`,
|
|
128
|
+
"Client.cs": coretest.d`
|
|
129
|
+
using Models;
|
|
130
|
+
using System;
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
namespace Client
|
|
133
|
+
{
|
|
134
|
+
public class Client
|
|
135
|
+
{
|
|
136
|
+
public Output MethodOne(Input bodyParam) {}
|
|
137
|
+
}
|
|
138
|
+
TestEnum.Two;
|
|
139
|
+
}
|
|
140
|
+
`
|
|
141
|
+
});
|
|
139
142
|
});
|
package/dist/test/utils.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare function TestNamespace(props: {
|
|
|
4
4
|
}): core.Children;
|
|
5
5
|
export declare function toSourceText(c: core.Children): string;
|
|
6
6
|
export declare function testRender(c: core.Children): core.OutputDirectory;
|
|
7
|
-
export declare function findFile(res: core.OutputDirectory, path: string): core.
|
|
7
|
+
export declare function findFile(res: core.OutputDirectory, path: string): core.ContentOutputFile;
|
|
8
8
|
export declare function assertFileContents(res: core.OutputDirectory, expectedFiles: Record<string, string>): void;
|
|
9
9
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/test/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAKvC,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB,GAAG,IAAI,CAAC,QAAQ,CAMhB;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAWrD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAMjE;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,IAAI,EAAE,MAAM,GACX,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAKvC,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB,GAAG,IAAI,CAAC,QAAQ,CAMhB;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAWrD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAMjE;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,IAAI,EAAE,MAAM,GACX,IAAI,CAAC,iBAAiB,CA2BxB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,IAAI,CAKN"}
|