@alloy-js/csharp 0.18.0-dev.7 → 0.18.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.
Files changed (58) hide show
  1. package/dist/src/components/ClassDeclaration.d.ts +2 -0
  2. package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
  3. package/dist/src/components/ClassDeclaration.js +6 -1
  4. package/dist/src/components/ClassMethod.d.ts +2 -0
  5. package/dist/src/components/ClassMethod.d.ts.map +1 -1
  6. package/dist/src/components/ClassMethod.js +6 -1
  7. package/dist/src/components/doc/comment.d.ts +70 -0
  8. package/dist/src/components/doc/comment.d.ts.map +1 -0
  9. package/dist/src/components/doc/comment.js +88 -0
  10. package/dist/src/components/doc/comment.test.d.ts +2 -0
  11. package/dist/src/components/doc/comment.test.d.ts.map +1 -0
  12. package/dist/src/components/doc/comment.test.js +348 -0
  13. package/dist/src/components/doc/from-markdown.d.ts +6 -0
  14. package/dist/src/components/doc/from-markdown.d.ts.map +1 -0
  15. package/dist/src/components/doc/from-markdown.js +58 -0
  16. package/dist/src/components/doc/from-markdown.test.d.ts +2 -0
  17. package/dist/src/components/doc/from-markdown.test.d.ts.map +1 -0
  18. package/dist/src/components/doc/from-markdown.test.js +83 -0
  19. package/dist/src/components/index.d.ts +2 -0
  20. package/dist/src/components/index.d.ts.map +1 -1
  21. package/dist/src/components/index.js +2 -0
  22. package/dist/src/components/interface/declaration.d.ts +2 -0
  23. package/dist/src/components/interface/declaration.d.ts.map +1 -1
  24. package/dist/src/components/interface/declaration.js +6 -1
  25. package/dist/src/components/interface/declaration.test.js +13 -0
  26. package/dist/src/components/interface/method.d.ts +2 -0
  27. package/dist/src/components/interface/method.d.ts.map +1 -1
  28. package/dist/src/components/interface/method.js +6 -1
  29. package/dist/src/components/interface/method.test.js +21 -0
  30. package/dist/src/components/interface/property.d.ts +2 -0
  31. package/dist/src/components/interface/property.d.ts.map +1 -1
  32. package/dist/src/components/interface/property.js +7 -2
  33. package/dist/src/components/interface/property.test.js +24 -0
  34. package/dist/test/class-method.test.js +21 -0
  35. package/dist/test/class.test.js +13 -0
  36. package/dist/test/vitest.setup.d.ts +2 -0
  37. package/dist/test/vitest.setup.d.ts.map +1 -0
  38. package/dist/test/vitest.setup.js +1 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +3 -2
  41. package/src/components/ClassDeclaration.tsx +4 -0
  42. package/src/components/ClassMethod.tsx +5 -0
  43. package/src/components/doc/comment.test.tsx +337 -0
  44. package/src/components/doc/comment.tsx +152 -0
  45. package/src/components/doc/from-markdown.test.tsx +103 -0
  46. package/src/components/doc/from-markdown.tsx +58 -0
  47. package/src/components/index.ts +2 -0
  48. package/src/components/interface/declaration.test.tsx +11 -0
  49. package/src/components/interface/declaration.tsx +5 -0
  50. package/src/components/interface/method.test.tsx +16 -0
  51. package/src/components/interface/method.tsx +5 -0
  52. package/src/components/interface/property.test.tsx +22 -0
  53. package/src/components/interface/property.tsx +5 -0
  54. package/temp/api.json +2140 -154
  55. package/test/class-method.test.tsx +16 -0
  56. package/test/class.test.tsx +11 -0
  57. package/test/vitest.setup.ts +1 -0
  58. package/vitest.config.ts +3 -0
@@ -0,0 +1,83 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { d } from "@alloy-js/core/testing";
3
+ import { describe, expect, it } from "vitest";
4
+ import { DocFromMarkdown } from "./from-markdown.js";
5
+ it("convert code block to <code>", () => {
6
+ expect(_$createComponent(DocFromMarkdown, {
7
+ markdown: d`
8
+ Some markdown with code
9
+ \`\`\`csharp
10
+ var foo = "bar";
11
+ \`\`\`
12
+ `
13
+ })).toRenderTo(`
14
+ Some markdown with code
15
+ <code>
16
+ var foo = "bar";
17
+ </code>
18
+ `);
19
+ });
20
+ it("convert inline code block to <c>", () => {
21
+ expect(_$createComponent(DocFromMarkdown, {
22
+ markdown: d`
23
+ Some markdown with \`inline\` code
24
+ `
25
+ })).toRenderTo(`
26
+ Some markdown with <c>inline</c> code
27
+ `);
28
+ });
29
+ it("convert link to <see>", () => {
30
+ expect(_$createComponent(DocFromMarkdown, {
31
+ markdown: d`
32
+ Some markdown with [link](https://example.com)
33
+ `
34
+ })).toRenderTo(`
35
+ Some markdown with <see href="https://example.com">link</see>
36
+ `);
37
+ });
38
+ it("convert bullet list to <list>", () => {
39
+ expect(_$createComponent(DocFromMarkdown, {
40
+ markdown: d`
41
+ - Item 1
42
+ - Item 2
43
+ - Item 3
44
+ `
45
+ })).toRenderTo(`
46
+ <list type="bullet">
47
+ <item><description>Item 1</description></item>
48
+ <item><description>Item 2</description></item>
49
+ <item><description>Item 3</description></item>
50
+ </list>
51
+ `);
52
+ });
53
+ it("convert numbered list to <list>", () => {
54
+ expect(_$createComponent(DocFromMarkdown, {
55
+ markdown: d`
56
+ 1. Item 1
57
+ 2. Item 2
58
+ 3. Item 3
59
+ `
60
+ })).toRenderTo(`
61
+ <list type="number">
62
+ <item><description>Item 1</description></item>
63
+ <item><description>Item 2</description></item>
64
+ <item><description>Item 3</description></item>
65
+ </list>
66
+ `);
67
+ });
68
+ describe("strip unsupported elements", () => {
69
+ it("bold", () => {
70
+ expect(_$createComponent(DocFromMarkdown, {
71
+ markdown: d`
72
+ Some markdown with **bold** text
73
+ `
74
+ })).toRenderTo(`Some markdown with bold text`);
75
+ });
76
+ it("italic", () => {
77
+ expect(_$createComponent(DocFromMarkdown, {
78
+ markdown: d`
79
+ Some markdown with *italic* text
80
+ `
81
+ })).toRenderTo(`Some markdown with italic text`);
82
+ });
83
+ });
@@ -1,6 +1,8 @@
1
1
  export * from "./ClassDeclaration.jsx";
2
2
  export * from "./ClassMethod.jsx";
3
3
  export * from "./Declaration.js";
4
+ export * from "./doc/comment.jsx";
5
+ export * from "./doc/from-markdown.jsx";
4
6
  export * from "./EnumDeclaration.jsx";
5
7
  export * from "./interface/declaration.js";
6
8
  export * from "./interface/method.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  export * from "./ClassDeclaration.js";
2
2
  export * from "./ClassMethod.js";
3
3
  export * from "./Declaration.js";
4
+ export * from "./doc/comment.js";
5
+ export * from "./doc/from-markdown.js";
4
6
  export * from "./EnumDeclaration.js";
5
7
  export * from "./interface/declaration.js";
6
8
  export * from "./interface/method.js";
@@ -5,6 +5,8 @@ export interface InterfaceModifiers {
5
5
  }
6
6
  export interface InterfaceDeclarationProps extends Omit<core.DeclarationProps, "nameKind">, AccessModifiers, InterfaceModifiers {
7
7
  name: string;
8
+ /** Doc comment */
9
+ doc?: core.Children;
8
10
  refkey?: core.Refkey;
9
11
  typeParameters?: Record<string, core.Refkey>;
10
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAM5B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAKD,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,kBAAkB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,iBAuDpE"}
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAKD,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAC7C,eAAe,EACf,kBAAkB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,kBAAkB;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,iBAwDpE"}
@@ -4,6 +4,7 @@ import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../
4
4
  import { useCSharpNamePolicy } from "../../name-policy.js";
5
5
  import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope } from "../../symbols/scopes.js";
7
+ import { DocWhen } from "../doc/comment.js";
7
8
  import { Name } from "../Name.js";
8
9
  const getInterfaceModifiers = makeModifiers(["partial"]);
9
10
 
@@ -69,7 +70,11 @@ export function InterfaceDeclaration(props) {
69
70
  return _$createComponent(core.Declaration, {
70
71
  symbol: thisInterfaceSymbol,
71
72
  get children() {
72
- return [modifiers, "interface ", _$createComponent(Name, {}), typeParams, _$memo(() => _$memo(() => !!props.children)() ? _$createComponent(core.Block, {
73
+ return [_$createComponent(DocWhen, {
74
+ get doc() {
75
+ return props.doc;
76
+ }
77
+ }), modifiers, "interface ", _$createComponent(Name, {}), typeParams, _$memo(() => _$memo(() => !!props.children)() ? _$createComponent(core.Block, {
73
78
  newline: true,
74
79
  get children() {
75
80
  return _$createComponent(core.Scope, {
@@ -53,4 +53,17 @@ describe("modifiers", () => {
53
53
  public partial interface TestInterface;
54
54
  `);
55
55
  });
56
+ });
57
+ it("specify doc comment", () => {
58
+ expect(_$createComponent(TestNamespace, {
59
+ get children() {
60
+ return _$createComponent(InterfaceDeclaration, {
61
+ name: "TestInterface",
62
+ doc: "This is a test"
63
+ });
64
+ }
65
+ })).toRenderTo(`
66
+ /// This is a test
67
+ interface TestInterface;
68
+ `);
56
69
  });
@@ -11,6 +11,8 @@ export interface InterfaceMethodProps extends AccessModifiers, InterfaceMethodMo
11
11
  children?: Children;
12
12
  parameters?: Array<ParameterProps>;
13
13
  returns?: Children;
14
+ /** Doc comment */
15
+ doc?: Children;
14
16
  }
15
17
  export declare function InterfaceMethod(props: InterfaceMethodProps): Children;
16
18
  //# sourceMappingURL=method.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAE/D,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAKD,MAAM,WAAW,oBACf,SAAQ,eAAe,EACrB,wBAAwB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,YAsC1D"}
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAGR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAG/D,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAKD,MAAM,WAAW,oBACf,SAAQ,eAAe,EACrB,wBAAwB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,YAuC1D"}
@@ -5,6 +5,7 @@ import { useCSharpNamePolicy } from "../../name-policy.js";
5
5
  import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
7
7
  import { Parameters } from "../Parameters.js";
8
+ import { DocWhen } from "../doc/comment.js";
8
9
 
9
10
  /** Method modifiers. Can only be one. */
10
11
 
@@ -41,7 +42,11 @@ export function InterfaceMethod(props) {
41
42
  return _$createComponent(Scope, {
42
43
  value: methodScope,
43
44
  get children() {
44
- return [modifiers, _$memo(() => props.returns ?? "void"), " ", name, "(", params, ")", _$memo(() => _$memo(() => !!props.children)() ? _$createComponent(Block, {
45
+ return [_$createComponent(DocWhen, {
46
+ get doc() {
47
+ return props.doc;
48
+ }
49
+ }), modifiers, _$memo(() => props.returns ?? "void"), " ", name, "(", params, ")", _$memo(() => _$memo(() => !!props.children)() ? _$createComponent(Block, {
45
50
  newline: true,
46
51
  get children() {
47
52
  return props.children;
@@ -107,4 +107,25 @@ it("defines params and return type", () => {
107
107
  public string MethodOne(int intParam, string stringParam);
108
108
  }
109
109
  `);
110
+ });
111
+ it("specify doc comment", () => {
112
+ expect(_$createComponent(TestNamespace, {
113
+ get children() {
114
+ return _$createComponent(InterfaceDeclaration, {
115
+ name: "Test",
116
+ get children() {
117
+ return _$createComponent(InterfaceMethod, {
118
+ name: "Method",
119
+ doc: "This is a test"
120
+ });
121
+ }
122
+ });
123
+ }
124
+ })).toRenderTo(`
125
+ interface Test
126
+ {
127
+ /// This is a test
128
+ void Method();
129
+ }
130
+ `);
110
131
  });
@@ -14,6 +14,8 @@ export interface InterfacePropertyProps extends AccessModifiers, InterfaceProper
14
14
  get?: boolean;
15
15
  /** If property should have a setter */
16
16
  set?: boolean;
17
+ /** Doc comment */
18
+ doc?: Children;
17
19
  }
18
20
  export declare function InterfaceProperty(props: InterfacePropertyProps): Children;
19
21
  //# sourceMappingURL=property.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAK5B,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,8CAE5B,CAAC;AAGH,MAAM,WAAW,sBACf,SAAQ,eAAe,EACrB,0BAA0B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IAEf,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,YAsC9D"}
1
+ {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAM5B,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,8CAE5B,CAAC;AAGH,MAAM,WAAW,sBACf,SAAQ,eAAe,EACrB,0BAA0B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IAEf,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,YAuC9D"}
@@ -1,9 +1,10 @@
1
- import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
1
+ import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
2
  import { Block, List, MemberDeclaration, refkey, Scope } from "@alloy-js/core";
3
3
  import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
4
4
  import { useCSharpNamePolicy } from "../../name-policy.js";
5
5
  import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
6
6
  import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
7
+ import { DocWhen } from "../doc/comment.js";
7
8
 
8
9
  /** Method modifiers. Can only be one. */
9
10
 
@@ -35,7 +36,11 @@ export function InterfaceProperty(props) {
35
36
  return _$createComponent(Scope, {
36
37
  value: propertyScope,
37
38
  get children() {
38
- return [modifiers, _$memo(() => props.type), " ", name, " ", _$createComponent(Block, {
39
+ return [_$createComponent(DocWhen, {
40
+ get doc() {
41
+ return props.doc;
42
+ }
43
+ }), modifiers, _$memo(() => props.type), " ", name, " ", _$createComponent(Block, {
39
44
  newline: true,
40
45
  inline: true,
41
46
  get children() {
@@ -138,4 +138,28 @@ it("has getter and setter", () => {
138
138
  string TestProp { get; set; }
139
139
  }
140
140
  `);
141
+ });
142
+ it("specify doc comment", () => {
143
+ expect(_$createComponent(TestNamespace, {
144
+ get children() {
145
+ return _$createComponent(InterfaceDeclaration, {
146
+ name: "Test",
147
+ get children() {
148
+ return _$createComponent(InterfaceProperty, {
149
+ name: "Method",
150
+ type: "string",
151
+ get: true,
152
+ set: true,
153
+ doc: "This is a test"
154
+ });
155
+ }
156
+ });
157
+ }
158
+ })).toRenderTo(`
159
+ interface Test
160
+ {
161
+ /// This is a test
162
+ string Method { get; set; }
163
+ }
164
+ `);
141
165
  });
@@ -137,4 +137,25 @@ it("defines params and return type", () => {
137
137
  public string MethodOne(int intParam, string stringParam) {}
138
138
  }
139
139
  `);
140
+ });
141
+ it("specify doc comment", () => {
142
+ expect(_$createComponent(TestNamespace, {
143
+ get children() {
144
+ return _$createComponent(ClassDeclaration, {
145
+ name: "Test",
146
+ get children() {
147
+ return _$createComponent(ClassMethod, {
148
+ name: "Method",
149
+ doc: "This is a test"
150
+ });
151
+ }
152
+ });
153
+ }
154
+ })).toRenderTo(`
155
+ class Test
156
+ {
157
+ /// This is a test
158
+ void Method() {}
159
+ }
160
+ `);
140
161
  });
@@ -337,4 +337,17 @@ it("declares class with constructor params and assigns values to fields", () =>
337
337
  }
338
338
  }
339
339
  `);
340
+ });
341
+ it("specify doc comment", () => {
342
+ expect(_$createComponent(utils.TestNamespace, {
343
+ get children() {
344
+ return _$createComponent(ClassDeclaration, {
345
+ name: "Test",
346
+ doc: "This is a test"
347
+ });
348
+ }
349
+ })).toRenderTo(`
350
+ /// This is a test
351
+ class Test;
352
+ `);
340
353
  });
@@ -0,0 +1,2 @@
1
+ import "@alloy-js/core/testing";
2
+ //# sourceMappingURL=vitest.setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.setup.d.ts","sourceRoot":"","sources":["../../test/vitest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ import "@alloy-js/core/testing";