@needle-tools/needle-component-compiler 1.9.4 → 1.10.0

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.
@@ -1,26 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- var helpers_1 = require("./helpers");
4
- describe('Basic typescript', function () {
5
- it('should generate component', function () {
6
- (0, helpers_1.compareCodegenWithDefaultContext)("basic",
7
- // INPUT
8
- "export class BasicComponet extends Behaviour {\n}\n",
9
- // EXPECTED
10
- "public partial class BasicComponet : UnityEngine.MonoBehaviour\n\t{\n\t}");
11
- });
12
- it('should not generate component', function () {
13
- (0, helpers_1.compareCodegen)("basic-no-export",
14
- // INPUT
15
- "\n //@dont-generate-component\n export class BasicComponet extends Behaviour {\n}\n",
16
- // EXPECTED
17
- "");
18
- });
19
- it('should ignore abstract type', function () {
20
- (0, helpers_1.compareCodegen)("basic-no-export",
21
- // INPUT
22
- "\n //@dont-generate-component\n export abstract class BasicComponet extends Behaviour {\n}\n",
23
- // EXPECTED
24
- "");
25
- });
26
- });
@@ -1,57 +0,0 @@
1
- import { compareCodegen, compareCodegenWithDefaultContext } from './helpers';
2
-
3
-
4
- describe('Basic typescript', () => {
5
-
6
- it('should generate component', () => {
7
- compareCodegenWithDefaultContext("basic",
8
- // INPUT
9
- `export class BasicComponet extends Behaviour {
10
- }
11
- `,
12
- // EXPECTED
13
- `public partial class BasicComponet : UnityEngine.MonoBehaviour
14
- {
15
- }`
16
- );
17
- });
18
-
19
-
20
-
21
- it('should not generate component', () => {
22
- compareCodegen("basic-no-export",
23
- // INPUT
24
- `
25
- //@dont-generate-component
26
- export class BasicComponet extends Behaviour {
27
- }
28
- `,
29
- // EXPECTED
30
- ``
31
- );
32
- });
33
-
34
-
35
-
36
-
37
- it('should ignore abstract type', () => {
38
- compareCodegen("basic-no-export",
39
- // INPUT
40
- `
41
- //@dont-generate-component
42
- export abstract class BasicComponet extends Behaviour {
43
- }
44
- `,
45
- // EXPECTED
46
- ``
47
- );
48
- });
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
- });
57
-
@@ -1,82 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- var helpers_1 = require("./helpers");
4
- describe('Typescript with public methods', function () {
5
- it('should generate component with public method', function () {
6
- (0, helpers_1.compareCodegenWithDefaultContext)("public.methods",
7
- // INPUT
8
- "export class MyComponent extends Behaviour {\n public myMethod(): void {}\n}\n",
9
- // EXPECTED
10
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void myMethod(){}\n\t}");
11
- });
12
- it('should generate component method and number args', function () {
13
- (0, helpers_1.compareCodegenWithDefaultContext)("public method with args",
14
- // INPUT
15
- "export class MyComponent extends Behaviour {\n public myMethod(myNumber: number): void {}\n}\n",
16
- // EXPECTED
17
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void myMethod(float @myNumber){}\n\t}");
18
- });
19
- it('should generate component method and multiple number args', function () {
20
- (0, helpers_1.compareCodegenWithDefaultContext)("public method with multiple args",
21
- // INPUT
22
- "export class MyComponent extends Behaviour {\n public myMethod(myNumber: number, myOtherNumber : number): void {}\n}\n",
23
- // EXPECTED
24
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void myMethod(float @myNumber, float @myOtherNumber){}\n\t}");
25
- });
26
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/11
27
- it('should generate component method but ignore inline type declaration', function () {
28
- (0, helpers_1.compareCodegenWithDefaultContext)("method ignore inline type declaration",
29
- // INPUT
30
- "export class MyComponent extends Behaviour {\n public myMethod(myNumber: { x : number, y:number, z : number}): void {}\n}\n",
31
- // EXPECTED
32
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void myMethod(object @myNumber){}\n\t}");
33
- });
34
- });
35
- describe('Typescript with private or protected methods', function () {
36
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/13
37
- it('should ignore private method', function () {
38
- (0, helpers_1.compareCodegenWithDefaultContext)("private.methods",
39
- // INPUT
40
- "export class MyComponent extends Behaviour {\n private myMethod(): void {}\n}\n",
41
- // EXPECTED
42
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n\t}");
43
- });
44
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/13
45
- it('should ignore protected method', function () {
46
- (0, helpers_1.compareCodegenWithDefaultContext)("protected.methods",
47
- // INPUT
48
- "export class MyComponent extends Behaviour {\n protected myMethod(): void {}\n}\n",
49
- // EXPECTED
50
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n\t}");
51
- });
52
- });
53
- describe('Typescript with methods', function () {
54
- it('should not generate static method', function () {
55
- (0, helpers_1.compareCodegenWithDefaultContext)("static method",
56
- // INPUT
57
- "export class MyComponent extends Behaviour {\n public static myMethod(): void {}\n}\n",
58
- // EXPECTED
59
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n\t}");
60
- });
61
- it('should not generate abstract method', function () {
62
- (0, helpers_1.compareCodegenWithDefaultContext)("abstract method",
63
- // INPUT
64
- "export class MyComponent extends Behaviour {\n public abstract myMethod(): void {}\n}\n",
65
- // EXPECTED
66
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n\t}");
67
- });
68
- it('should convert onEnable to OnEnable', function () {
69
- (0, helpers_1.compareCodegenWithDefaultContext)("abstract method",
70
- // INPUT
71
- "export class MyComponent extends Behaviour {\n onEnable() {}\n }\n}\n",
72
- // EXPECTED
73
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void OnEnable(){}\n\t}");
74
- });
75
- it('should convert onDisable to OnDisable', function () {
76
- (0, helpers_1.compareCodegenWithDefaultContext)("abstract method",
77
- // INPUT
78
- "export class MyComponent extends Behaviour {\n onDisable() {}\n }\n}\n",
79
- // EXPECTED
80
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void OnDisable(){}\n\t}");
81
- });
82
- });
@@ -1,185 +0,0 @@
1
- import { compareCodegen, compareCodegenWithDefaultContext } from './helpers';
2
-
3
-
4
- describe('Typescript with public methods', () => {
5
-
6
-
7
- it('should generate component with public method', () => {
8
- compareCodegenWithDefaultContext("public.methods",
9
- // INPUT
10
- `export class MyComponent extends Behaviour {
11
- public myMethod(): void {}
12
- }
13
- `,
14
- // EXPECTED
15
- `public partial class MyComponent : UnityEngine.MonoBehaviour
16
- {
17
- public void myMethod(){}
18
- }`
19
- );
20
- });
21
-
22
-
23
-
24
- it('should generate component method and number args', () => {
25
- compareCodegenWithDefaultContext("public method with args",
26
- // INPUT
27
- `export class MyComponent extends Behaviour {
28
- public myMethod(myNumber: number): void {}
29
- }
30
- `,
31
- // EXPECTED
32
- `public partial class MyComponent : UnityEngine.MonoBehaviour
33
- {
34
- public void myMethod(float @myNumber){}
35
- }`
36
- );
37
- });
38
-
39
-
40
-
41
- it('should generate component method and multiple number args', () => {
42
- compareCodegenWithDefaultContext("public method with multiple args",
43
- // INPUT
44
- `export class MyComponent extends Behaviour {
45
- public myMethod(myNumber: number, myOtherNumber : number): void {}
46
- }
47
- `,
48
- // EXPECTED
49
- `public partial class MyComponent : UnityEngine.MonoBehaviour
50
- {
51
- public void myMethod(float @myNumber, float @myOtherNumber){}
52
- }`
53
- );
54
- });
55
-
56
-
57
-
58
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/11
59
- it('should generate component method but ignore inline type declaration', () => {
60
- compareCodegenWithDefaultContext("method ignore inline type declaration",
61
- // INPUT
62
- `export class MyComponent extends Behaviour {
63
- public myMethod(myNumber: { x : number, y:number, z : number}): void {}
64
- }
65
- `,
66
- // EXPECTED
67
- `public partial class MyComponent : UnityEngine.MonoBehaviour
68
- {
69
- public void myMethod(object @myNumber){}
70
- }`
71
- );
72
- });
73
-
74
-
75
- });
76
-
77
-
78
-
79
-
80
- describe('Typescript with private or protected methods', () => {
81
-
82
-
83
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/13
84
- it('should ignore private method', () => {
85
- compareCodegenWithDefaultContext("private.methods",
86
- // INPUT
87
- `export class MyComponent extends Behaviour {
88
- private myMethod(): void {}
89
- }
90
- `,
91
- // EXPECTED
92
- `public partial class MyComponent : UnityEngine.MonoBehaviour
93
- {
94
- }`
95
- );
96
- });
97
-
98
-
99
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/13
100
- it('should ignore protected method', () => {
101
- compareCodegenWithDefaultContext("protected.methods",
102
- // INPUT
103
- `export class MyComponent extends Behaviour {
104
- protected myMethod(): void {}
105
- }
106
- `,
107
- // EXPECTED
108
- `public partial class MyComponent : UnityEngine.MonoBehaviour
109
- {
110
- }`
111
- );
112
- });
113
-
114
- });
115
-
116
-
117
-
118
- describe('Typescript with methods', () => {
119
-
120
-
121
- it('should not generate static method', () => {
122
- compareCodegenWithDefaultContext("static method",
123
- // INPUT
124
- `export class MyComponent extends Behaviour {
125
- public static myMethod(): void {}
126
- }
127
- `,
128
- // EXPECTED
129
- `public partial class MyComponent : UnityEngine.MonoBehaviour
130
- {
131
- }`
132
- );
133
- });
134
-
135
-
136
- it('should not generate abstract method', () => {
137
- compareCodegenWithDefaultContext("abstract method",
138
- // INPUT
139
- `export class MyComponent extends Behaviour {
140
- public abstract myMethod(): void {}
141
- }
142
- `,
143
- // EXPECTED
144
- `public partial class MyComponent : UnityEngine.MonoBehaviour
145
- {
146
- }`
147
- );
148
- });
149
-
150
-
151
-
152
- it('should convert onEnable to OnEnable', () => {
153
- compareCodegenWithDefaultContext("abstract method",
154
- // INPUT
155
- `export class MyComponent extends Behaviour {
156
- onEnable() {}
157
- }
158
- }
159
- `,
160
- // EXPECTED
161
- `public partial class MyComponent : UnityEngine.MonoBehaviour
162
- {
163
- public void OnEnable(){}
164
- }`
165
- );
166
- });
167
-
168
-
169
- it('should convert onDisable to OnDisable', () => {
170
- compareCodegenWithDefaultContext("abstract method",
171
- // INPUT
172
- `export class MyComponent extends Behaviour {
173
- onDisable() {}
174
- }
175
- }
176
- `,
177
- // EXPECTED
178
- `public partial class MyComponent : UnityEngine.MonoBehaviour
179
- {
180
- public void OnDisable(){}
181
- }`
182
- );
183
- });
184
-
185
- });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- var helpers_1 = require("./helpers");
4
- describe('Typescript with nonSerialized', function () {
5
- it('should ignore field', function () {
6
- (0, helpers_1.compareCodegenWithDefaultContext)("nonserialized ignore field",
7
- // INPUT
8
- "export class MyComponent extends Behaviour {\n //@nonSerialized\n public myField: number;\n}\n",
9
- // EXPECTED
10
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n\t}");
11
- });
12
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/14
13
- it('should not affect next method', function () {
14
- (0, helpers_1.compareCodegenWithDefaultContext)("nonserialized on property does not affect method",
15
- // INPUT
16
- "export class MyComponent extends Behaviour {\n //@nonSerialized\n public get myField(): number { return 0; }\n\n public myMethod() {\n\n }\n}\n",
17
- // EXPECTED
18
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public void myMethod() {}\n\t}");
19
- });
20
- });
@@ -1,45 +0,0 @@
1
- import { compareCodegen, compareCodegenWithDefaultContext } from './helpers';
2
-
3
-
4
- describe('Typescript with nonSerialized', () => {
5
-
6
-
7
- it('should ignore field', () => {
8
- compareCodegenWithDefaultContext("nonserialized ignore field",
9
- // INPUT
10
- `export class MyComponent extends Behaviour {
11
- //@nonSerialized
12
- public myField: number;
13
- }
14
- `,
15
- // EXPECTED
16
- `public partial class MyComponent : UnityEngine.MonoBehaviour
17
- {
18
- }`
19
- );
20
- });
21
-
22
-
23
- // https://github.com/needle-tools/needle-tiny-component-compiler/issues/14
24
- it('should not affect next method', () => {
25
- compareCodegenWithDefaultContext("nonserialized on property does not affect method",
26
- // INPUT
27
- `export class MyComponent extends Behaviour {
28
- //@nonSerialized
29
- public get myField(): number { return 0; }
30
-
31
- public myMethod() {
32
-
33
- }
34
- }
35
- `,
36
- // EXPECTED
37
- `public partial class MyComponent : UnityEngine.MonoBehaviour
38
- {
39
- public void myMethod() {}
40
- }`
41
- );
42
- });
43
-
44
-
45
- });
@@ -1,61 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- var helpers_1 = require("./helpers");
4
- describe('Typescript with fields', function () {
5
- it('should generate component with number', function () {
6
- (0, helpers_1.compareCodegenWithDefaultContext)("number",
7
- // INPUT
8
- "export class MyComponent extends Behaviour {\n public myField: number;\n}\n",
9
- // EXPECTED
10
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public float @myField;\n\t}");
11
- });
12
- it('should generate component with string', function () {
13
- (0, helpers_1.compareCodegenWithDefaultContext)("string",
14
- // INPUT
15
- "export class MyComponent extends Behaviour {\n public myField: string;\n}\n",
16
- // EXPECTED
17
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public string @myField;\n\t}");
18
- });
19
- it('should generate component with string array', function () {
20
- (0, helpers_1.compareCodegenWithDefaultContext)("stringArray",
21
- // INPUT
22
- "export class MyComponent extends Behaviour {\n public myField: string[];\n}\n",
23
- // EXPECTED
24
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public string[] @myField;\n\t}");
25
- });
26
- it('should generate component with boolean', function () {
27
- (0, helpers_1.compareCodegenWithDefaultContext)("bool",
28
- // INPUT
29
- "export class MyComponent extends Behaviour {\n public myField: boolean;\n}\n",
30
- // EXPECTED
31
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public bool @myField;\n\t}");
32
- });
33
- it('should generate component with object', function () {
34
- (0, helpers_1.compareCodegenWithDefaultContext)("object",
35
- // INPUT
36
- "export class MyComponent extends Behaviour {\n public myField: object;\n}\n",
37
- // EXPECTED
38
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public UnityEngine.Object @myField;\n\t}");
39
- });
40
- it('should generate component with default values', function () {
41
- (0, helpers_1.compareCodegenWithDefaultContext)("fields with default values",
42
- // INPUT
43
- "export class MyComponent extends Behaviour {\n public myField: number = 42;\n public myField2: string = \"hello\";\n public myField3: boolean = true;\n public myField4: object = null;\n public myVector2: Vector2 = new Vector2(1, .5);\n}\n",
44
- // EXPECTED
45
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public float @myField = 42f;\n public string @myField2 = \"hello\";\n public bool @myField3 = true;\n public UnityEngine.Object @myField4;\n\t\tpublic UnityEngine.Vector2 @myVector2 = new UnityEngine.Vector2(1f, .5f);\n\t}");
46
- });
47
- it('should generate component with GameObject reference', function () {
48
- (0, helpers_1.compareCodegenWithDefaultContext)("object",
49
- // INPUT
50
- "export class MyComponent extends Behaviour {\n public myObject: Object3D;\n}\n",
51
- // EXPECTED
52
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public UnityEngine.GameObject @myObject;\n\t}");
53
- });
54
- it('should generate component with RectTransform reference', function () {
55
- (0, helpers_1.compareCodegenWithDefaultContext)("object",
56
- // INPUT
57
- "export class MyComponent extends Behaviour {\n public myRect: RectTransform;\n}\n",
58
- // EXPECTED
59
- "public partial class MyComponent : UnityEngine.MonoBehaviour\n\t{\n public UnityEngine.RectTransform @myRect;\n\t}");
60
- });
61
- });
@@ -1,158 +0,0 @@
1
- import { compareCodegen, compareCodegenWithDefaultContext } from './helpers';
2
-
3
-
4
- describe('Typescript with fields', () => {
5
-
6
-
7
- it('should generate component with number', () => {
8
- compareCodegenWithDefaultContext("number",
9
- // INPUT
10
- `export class MyComponent extends Behaviour {
11
- public myField: number;
12
- }
13
- `,
14
- // EXPECTED
15
- `public partial class MyComponent : UnityEngine.MonoBehaviour
16
- {
17
- public float @myField;
18
- }`
19
- );
20
- });
21
-
22
-
23
-
24
- it('should generate component with string', () => {
25
- compareCodegenWithDefaultContext("string",
26
- // INPUT
27
- `export class MyComponent extends Behaviour {
28
- public myField: string;
29
- }
30
- `,
31
- // EXPECTED
32
- `public partial class MyComponent : UnityEngine.MonoBehaviour
33
- {
34
- public string @myField;
35
- }`
36
- );
37
- });
38
-
39
-
40
-
41
-
42
- it('should generate component with string array', () => {
43
- compareCodegenWithDefaultContext("stringArray",
44
- // INPUT
45
- `export class MyComponent extends Behaviour {
46
- public myField: string[];
47
- }
48
- `,
49
- // EXPECTED
50
- `public partial class MyComponent : UnityEngine.MonoBehaviour
51
- {
52
- public string[] @myField;
53
- }`
54
- );
55
- });
56
-
57
-
58
-
59
-
60
- it('should generate component with boolean', () => {
61
- compareCodegenWithDefaultContext("bool",
62
- // INPUT
63
- `export class MyComponent extends Behaviour {
64
- public myField: boolean;
65
- }
66
- `,
67
- // EXPECTED
68
- `public partial class MyComponent : UnityEngine.MonoBehaviour
69
- {
70
- public bool @myField;
71
- }`
72
- );
73
- });
74
-
75
-
76
-
77
-
78
- it('should generate component with object', () => {
79
- compareCodegenWithDefaultContext("object",
80
- // INPUT
81
- `export class MyComponent extends Behaviour {
82
- public myField: object;
83
- }
84
- `,
85
- // EXPECTED
86
- `public partial class MyComponent : UnityEngine.MonoBehaviour
87
- {
88
- public UnityEngine.Object @myField;
89
- }`
90
- );
91
- });
92
-
93
-
94
-
95
-
96
- it('should generate component with default values', () => {
97
- compareCodegenWithDefaultContext("fields with default values",
98
- // INPUT
99
- `export class MyComponent extends Behaviour {
100
- public myField: number = 42;
101
- public myField2: string = "hello";
102
- public myField3: boolean = true;
103
- public myField4: object = null;
104
- public myVector2: Vector2 = new Vector2(1, .5);
105
- }
106
- `,
107
- // EXPECTED
108
- `public partial class MyComponent : UnityEngine.MonoBehaviour
109
- {
110
- public float @myField = 42f;
111
- public string @myField2 = "hello";
112
- public bool @myField3 = true;
113
- public UnityEngine.Object @myField4;
114
- public UnityEngine.Vector2 @myVector2 = new UnityEngine.Vector2(1f, .5f);
115
- }`
116
- );
117
- });
118
-
119
-
120
-
121
-
122
-
123
- it('should generate component with GameObject reference', () => {
124
- compareCodegenWithDefaultContext("object",
125
- // INPUT
126
- `export class MyComponent extends Behaviour {
127
- public myObject: Object3D;
128
- }
129
- `,
130
- // EXPECTED
131
- `public partial class MyComponent : UnityEngine.MonoBehaviour
132
- {
133
- public UnityEngine.GameObject @myObject;
134
- }`
135
- );
136
- });
137
-
138
-
139
-
140
-
141
- it('should generate component with RectTransform reference', () => {
142
- compareCodegenWithDefaultContext("object",
143
- // INPUT
144
- `export class MyComponent extends Behaviour {
145
- public myRect: RectTransform;
146
- }
147
- `,
148
- // EXPECTED
149
- `public partial class MyComponent : UnityEngine.MonoBehaviour
150
- {
151
- public UnityEngine.RectTransform @myRect;
152
- }`
153
- );
154
- });
155
-
156
-
157
-
158
- });
package/test/helpers.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.compareCodegenWithDefaultContext = exports.compareCodegen = exports.testCompile = void 0;
4
- var component_compiler_1 = require("../src/component-compiler");
5
- var chai_1 = require("chai");
6
- var fs = require("fs");
7
- var TestOptions = /** @class */ (function () {
8
- function TestOptions() {
9
- this.ignoreWhiteSpace = true;
10
- }
11
- return TestOptions;
12
- }());
13
- function testCompile(code) {
14
- var res = (0, component_compiler_1.compile)(code, "test", null, false);
15
- var output = (res === null || res === void 0 ? void 0 : res.length) > 0 ? res[0] : "";
16
- return output;
17
- }
18
- exports.testCompile = testCompile;
19
- function compareByLine(output, expected) {
20
- var splitCode = /\r?\n/;
21
- if (output == null) {
22
- (0, chai_1.expect)(expected).to.equal(output);
23
- }
24
- else {
25
- var outputLines = output.split(splitCode);
26
- var expectedLines = expected.split(splitCode);
27
- for (var i = 0; i < outputLines.length; i++) {
28
- var outputLine = outputLines[i].trim();
29
- var expectedLine = expectedLines[i].trim();
30
- (0, chai_1.expect)(outputLine).to.equal(expectedLine, "Line ".concat(i, " does not match"));
31
- }
32
- }
33
- }
34
- function compareCodegen(id, input, expected) {
35
- var baseDir = "test/codegen";
36
- if (!fs.existsSync(baseDir))
37
- fs.mkdirSync(baseDir);
38
- var dir = "".concat(baseDir, "/").concat(id);
39
- if (!fs.existsSync(dir))
40
- fs.mkdirSync(dir);
41
- fs.writeFileSync("".concat(dir, "\\input.ts"), input);
42
- var result = testCompile(input);
43
- if (result !== null)
44
- fs.writeFileSync("".concat(dir, "\\output.cs"), result);
45
- fs.writeFileSync("".concat(dir, "\\expected.cs"), expected);
46
- compareByLine(result, expected);
47
- // expect(result).to.equal(expected);
48
- }
49
- exports.compareCodegen = compareCodegen;
50
- function compareCodegenWithDefaultContext(id, input, expected) {
51
- expected = "// NEEDLE_CODEGEN_START\n // auto generated code - do not edit directly\n \n #pragma warning disable\n \n namespace Needle.Typescript.GeneratedComponents\n {\n \t" + expected + "\n }\n \n // NEEDLE_CODEGEN_END";
52
- return compareCodegen(id, input, expected);
53
- }
54
- exports.compareCodegenWithDefaultContext = compareCodegenWithDefaultContext;