@alloy-js/python 0.5.0-dev.0 → 0.5.0-dev.2
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/dev/src/builtins/python.js +46 -0
- package/dist/dev/src/builtins/python.js.map +1 -1
- package/dist/dev/src/components/ClassDeclaration.js +19 -10
- package/dist/dev/src/components/ClassDeclaration.js.map +1 -1
- package/dist/dev/src/components/ClassMethodDeclaration.js +20 -5
- package/dist/dev/src/components/ClassMethodDeclaration.js.map +1 -1
- package/dist/dev/src/components/DataclassDeclaration.js +14 -12
- package/dist/dev/src/components/DataclassDeclaration.js.map +1 -1
- package/dist/dev/src/components/DecoratorList.js +55 -0
- package/dist/dev/src/components/DecoratorList.js.map +1 -0
- package/dist/dev/src/components/EnumDeclaration.js +21 -12
- package/dist/dev/src/components/EnumDeclaration.js.map +1 -1
- package/dist/dev/src/components/FunctionBase.js +21 -10
- package/dist/dev/src/components/FunctionBase.js.map +1 -1
- package/dist/dev/src/components/FutureStatement.js +1 -1
- package/dist/dev/src/components/MethodBase.js +16 -4
- package/dist/dev/src/components/MethodBase.js.map +1 -1
- package/dist/dev/src/components/PropertyDeclaration.js +68 -17
- package/dist/dev/src/components/PropertyDeclaration.js.map +1 -1
- package/dist/dev/src/components/PydanticClassDeclaration.js +136 -0
- package/dist/dev/src/components/PydanticClassDeclaration.js.map +1 -0
- package/dist/dev/src/components/SourceFile.js +44 -32
- package/dist/dev/src/components/SourceFile.js.map +1 -1
- package/dist/dev/src/components/StaticMethodDeclaration.js +19 -5
- package/dist/dev/src/components/StaticMethodDeclaration.js.map +1 -1
- package/dist/dev/src/components/index.js +1 -0
- package/dist/dev/src/components/index.js.map +1 -1
- package/dist/dev/test/callsignatures.test.js +471 -297
- package/dist/dev/test/callsignatures.test.js.map +1 -1
- package/dist/dev/test/class-method-declaration.test.js +21 -10
- package/dist/dev/test/class-method-declaration.test.js.map +1 -1
- package/dist/dev/test/classdeclarations.test.js +480 -381
- package/dist/dev/test/classdeclarations.test.js.map +1 -1
- package/dist/dev/test/classinstantiations.test.js +201 -168
- package/dist/dev/test/classinstantiations.test.js.map +1 -1
- package/dist/dev/test/constructordeclaration.test.js +22 -11
- package/dist/dev/test/constructordeclaration.test.js.map +1 -1
- package/dist/dev/test/dataclassdeclarations.test.js +345 -358
- package/dist/dev/test/dataclassdeclarations.test.js.map +1 -1
- package/dist/dev/test/decoratorlist.test.js +131 -0
- package/dist/dev/test/decoratorlist.test.js.map +1 -0
- package/dist/dev/test/dundermethoddeclaration.test.js +22 -11
- package/dist/dev/test/dundermethoddeclaration.test.js.map +1 -1
- package/dist/dev/test/enums.test.js +231 -166
- package/dist/dev/test/enums.test.js.map +1 -1
- package/dist/dev/test/externals.test.js +57 -45
- package/dist/dev/test/externals.test.js.map +1 -1
- package/dist/dev/test/factories.test.js +124 -50
- package/dist/dev/test/factories.test.js.map +1 -1
- package/dist/dev/test/functioncallexpressions.test.js +199 -164
- package/dist/dev/test/functioncallexpressions.test.js.map +1 -1
- package/dist/dev/test/functiondeclaration.test.js +452 -265
- package/dist/dev/test/functiondeclaration.test.js.map +1 -1
- package/dist/dev/test/imports.test.js +273 -221
- package/dist/dev/test/imports.test.js.map +1 -1
- package/dist/dev/test/memberexpressions.test.js +1237 -972
- package/dist/dev/test/memberexpressions.test.js.map +1 -1
- package/dist/dev/test/methoddeclaration.test.js +200 -45
- package/dist/dev/test/methoddeclaration.test.js.map +1 -1
- package/dist/dev/test/namepolicies.test.js +130 -94
- package/dist/dev/test/namepolicies.test.js.map +1 -1
- package/dist/dev/test/propertydeclaration.test.js +177 -46
- package/dist/dev/test/propertydeclaration.test.js.map +1 -1
- package/dist/dev/test/pydanticclassdeclarations.test.js +1089 -0
- package/dist/dev/test/pydanticclassdeclarations.test.js.map +1 -0
- package/dist/dev/test/pydocs.test.js +888 -715
- package/dist/dev/test/pydocs.test.js.map +1 -1
- package/dist/dev/test/references.test.js +42 -35
- package/dist/dev/test/references.test.js.map +1 -1
- package/dist/dev/test/sourcefiles.test.js +1109 -841
- package/dist/dev/test/sourcefiles.test.js.map +1 -1
- package/dist/dev/test/staticmethoddeclaration.test.js +21 -10
- package/dist/dev/test/staticmethoddeclaration.test.js.map +1 -1
- package/dist/dev/test/type-checking-imports.test.js +408 -359
- package/dist/dev/test/type-checking-imports.test.js.map +1 -1
- package/dist/dev/test/typereference.test.js +55 -40
- package/dist/dev/test/typereference.test.js.map +1 -1
- package/dist/dev/test/uniontypeexpression.test.js +222 -146
- package/dist/dev/test/uniontypeexpression.test.js.map +1 -1
- package/dist/dev/test/utils.js +39 -77
- package/dist/dev/test/utils.js.map +1 -1
- package/dist/dev/test/values.test.js +237 -101
- package/dist/dev/test/values.test.js.map +1 -1
- package/dist/dev/test/variables.test.js +321 -203
- package/dist/dev/test/variables.test.js.map +1 -1
- package/dist/dev/test/vitest.setup.js +2 -0
- package/dist/dev/test/vitest.setup.js.map +1 -0
- package/dist/src/builtins/python.d.ts +30 -0
- package/dist/src/builtins/python.d.ts.map +1 -1
- package/dist/src/builtins/python.js +46 -0
- package/dist/src/builtins/python.js.map +1 -1
- package/dist/src/components/ClassDeclaration.d.ts +21 -0
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +6 -1
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/ClassMethodDeclaration.d.ts +5 -1
- package/dist/src/components/ClassMethodDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassMethodDeclaration.js +14 -3
- package/dist/src/components/ClassMethodDeclaration.js.map +1 -1
- package/dist/src/components/DataclassDeclaration.d.ts.map +1 -1
- package/dist/src/components/DataclassDeclaration.js +10 -4
- package/dist/src/components/DataclassDeclaration.js.map +1 -1
- package/dist/src/components/DecoratorList.d.ts +43 -0
- package/dist/src/components/DecoratorList.d.ts.map +1 -0
- package/dist/src/components/DecoratorList.js +47 -0
- package/dist/src/components/DecoratorList.js.map +1 -0
- package/dist/src/components/EnumDeclaration.d.ts +9 -0
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +6 -1
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/FunctionBase.d.ts +31 -1
- package/dist/src/components/FunctionBase.d.ts.map +1 -1
- package/dist/src/components/FunctionBase.js +9 -2
- package/dist/src/components/FunctionBase.js.map +1 -1
- package/dist/src/components/FutureStatement.d.ts +1 -1
- package/dist/src/components/FutureStatement.js +1 -1
- package/dist/src/components/MethodBase.d.ts.map +1 -1
- package/dist/src/components/MethodBase.js +10 -2
- package/dist/src/components/MethodBase.js.map +1 -1
- package/dist/src/components/PropertyDeclaration.d.ts +29 -0
- package/dist/src/components/PropertyDeclaration.d.ts.map +1 -1
- package/dist/src/components/PropertyDeclaration.js +48 -1
- package/dist/src/components/PropertyDeclaration.js.map +1 -1
- package/dist/src/components/PydanticClassDeclaration.d.ts +120 -0
- package/dist/src/components/PydanticClassDeclaration.d.ts.map +1 -0
- package/dist/src/components/PydanticClassDeclaration.js +116 -0
- package/dist/src/components/PydanticClassDeclaration.js.map +1 -0
- package/dist/src/components/SourceFile.d.ts +2 -2
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +12 -0
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/StaticMethodDeclaration.d.ts +3 -0
- package/dist/src/components/StaticMethodDeclaration.d.ts.map +1 -1
- package/dist/src/components/StaticMethodDeclaration.js +13 -3
- package/dist/src/components/StaticMethodDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/test/callsignatures.test.js +346 -272
- package/dist/test/callsignatures.test.js.map +1 -1
- package/dist/test/class-method-declaration.test.js +7 -4
- package/dist/test/class-method-declaration.test.js.map +1 -1
- package/dist/test/classdeclarations.test.js +316 -277
- package/dist/test/classdeclarations.test.js.map +1 -1
- package/dist/test/classinstantiations.test.js +112 -103
- package/dist/test/classinstantiations.test.js.map +1 -1
- package/dist/test/constructordeclaration.test.js +7 -4
- package/dist/test/constructordeclaration.test.js.map +1 -1
- package/dist/test/dataclassdeclarations.test.js +153 -178
- package/dist/test/dataclassdeclarations.test.js.map +1 -1
- package/dist/test/decoratorlist.test.d.ts +2 -0
- package/dist/test/decoratorlist.test.d.ts.map +1 -0
- package/dist/test/decoratorlist.test.js +83 -0
- package/dist/test/decoratorlist.test.js.map +1 -0
- package/dist/test/dundermethoddeclaration.test.js +7 -4
- package/dist/test/dundermethoddeclaration.test.js.map +1 -1
- package/dist/test/enums.test.js +172 -143
- package/dist/test/enums.test.js.map +1 -1
- package/dist/test/externals.test.js +24 -24
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/factories.test.js +75 -33
- package/dist/test/factories.test.js.map +1 -1
- package/dist/test/functioncallexpressions.test.js +117 -106
- package/dist/test/functioncallexpressions.test.js.map +1 -1
- package/dist/test/functiondeclaration.test.js +256 -173
- package/dist/test/functiondeclaration.test.js.map +1 -1
- package/dist/test/imports.test.js +171 -143
- package/dist/test/imports.test.js.map +1 -1
- package/dist/test/memberexpressions.test.js +582 -453
- package/dist/test/memberexpressions.test.js.map +1 -1
- package/dist/test/methoddeclaration.test.js +106 -19
- package/dist/test/methoddeclaration.test.js.map +1 -1
- package/dist/test/namepolicies.test.js +90 -78
- package/dist/test/namepolicies.test.js.map +1 -1
- package/dist/test/propertydeclaration.test.js +90 -15
- package/dist/test/propertydeclaration.test.js.map +1 -1
- package/dist/test/pydanticclassdeclarations.test.d.ts +2 -0
- package/dist/test/pydanticclassdeclarations.test.d.ts.map +1 -0
- package/dist/test/pydanticclassdeclarations.test.js +773 -0
- package/dist/test/pydanticclassdeclarations.test.js.map +1 -0
- package/dist/test/pydocs.test.js +573 -532
- package/dist/test/pydocs.test.js.map +1 -1
- package/dist/test/references.test.js +31 -28
- package/dist/test/references.test.js.map +1 -1
- package/dist/test/sourcefiles.test.js +700 -580
- package/dist/test/sourcefiles.test.js.map +1 -1
- package/dist/test/staticmethoddeclaration.test.js +7 -4
- package/dist/test/staticmethoddeclaration.test.js.map +1 -1
- package/dist/test/type-checking-imports.test.js +297 -284
- package/dist/test/type-checking-imports.test.js.map +1 -1
- package/dist/test/typereference.test.js +29 -22
- package/dist/test/typereference.test.js.map +1 -1
- package/dist/test/uniontypeexpression.test.js +124 -88
- package/dist/test/uniontypeexpression.test.js.map +1 -1
- package/dist/test/utils.d.ts +10 -17
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +32 -74
- package/dist/test/utils.js.map +1 -1
- package/dist/test/values.test.js +135 -67
- package/dist/test/values.test.js.map +1 -1
- package/dist/test/variables.test.js +201 -151
- package/dist/test/variables.test.js.map +1 -1
- package/dist/test/vitest.setup.d.ts +2 -0
- package/dist/test/vitest.setup.d.ts.map +1 -0
- package/dist/test/vitest.setup.js +2 -0
- package/dist/test/vitest.setup.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/ClassDeclaration.md +10 -7
- package/docs/api/components/ClassEnumDeclaration.md +9 -6
- package/docs/api/components/ClassMethodDeclaration.md +7 -5
- package/docs/api/components/DataclassDeclaration.md +9 -5
- package/docs/api/components/DunderMethodDeclaration.md +7 -5
- package/docs/api/components/FunctionDeclaration.md +9 -5
- package/docs/api/components/FutureStatement.md +1 -1
- package/docs/api/components/MethodDeclaration.md +11 -6
- package/docs/api/components/PropertyDeclaration.md +11 -8
- package/docs/api/components/PydanticClassDeclaration.md +146 -0
- package/docs/api/components/SourceFile.md +20 -8
- package/docs/api/components/StaticMethodDeclaration.md +7 -5
- package/docs/api/components/index.md +1 -0
- package/docs/api/index.md +3 -3
- package/docs/api/types/CommonFunctionProps.md +4 -3
- package/docs/api/types/PydanticModelConfigDictProps.md +32 -0
- package/docs/api/types/index.md +1 -0
- package/docs/api/variables/index.md +3 -0
- package/docs/api/variables/pydanticModule.md +27 -0
- package/docs/api/variables/pydanticSettingsModule.md +7 -0
- package/docs/api/variables/typingModule.md +9 -0
- package/package.json +4 -4
- package/src/builtins/python.ts +539 -1
- package/src/components/ClassDeclaration.tsx +23 -0
- package/src/components/ClassMethodDeclaration.tsx +9 -1
- package/src/components/DataclassDeclaration.tsx +18 -11
- package/src/components/DecoratorList.tsx +50 -0
- package/src/components/EnumDeclaration.tsx +11 -0
- package/src/components/FunctionBase.tsx +34 -3
- package/src/components/FutureStatement.tsx +1 -1
- package/src/components/MethodBase.tsx +6 -2
- package/src/components/PropertyDeclaration.tsx +48 -1
- package/src/components/PydanticClassDeclaration.tsx +222 -0
- package/src/components/SourceFile.tsx +6 -1
- package/src/components/StaticMethodDeclaration.tsx +7 -1
- package/src/components/index.ts +1 -0
- package/temp/api.json +1158 -86
- package/test/callsignatures.test.tsx +309 -283
- package/test/class-method-declaration.test.tsx +3 -4
- package/test/classdeclarations.test.tsx +277 -235
- package/test/classinstantiations.test.tsx +115 -109
- package/test/constructordeclaration.test.tsx +9 -6
- package/test/dataclassdeclarations.test.tsx +256 -349
- package/test/decoratorlist.test.tsx +114 -0
- package/test/dundermethoddeclaration.test.tsx +3 -4
- package/test/enums.test.tsx +84 -71
- package/test/externals.test.tsx +25 -25
- package/test/factories.test.tsx +64 -22
- package/test/functioncallexpressions.test.tsx +123 -109
- package/test/functiondeclaration.test.tsx +218 -140
- package/test/imports.test.tsx +119 -91
- package/test/memberexpressions.test.tsx +265 -207
- package/test/methoddeclaration.test.tsx +115 -24
- package/test/namepolicies.test.tsx +69 -69
- package/test/propertydeclaration.test.tsx +71 -7
- package/test/pydanticclassdeclarations.test.tsx +704 -0
- package/test/pydocs.test.tsx +531 -579
- package/test/references.test.tsx +24 -23
- package/test/sourcefiles.test.tsx +527 -492
- package/test/staticmethoddeclaration.test.tsx +3 -4
- package/test/type-checking-imports.test.tsx +206 -218
- package/test/typereference.test.tsx +15 -12
- package/test/uniontypeexpression.test.tsx +74 -61
- package/test/utils.tsx +26 -110
- package/test/values.test.tsx +82 -32
- package/test/variables.test.tsx +162 -142
- package/test/vitest.setup.ts +1 -0
- package/vitest.config.ts +3 -0
|
@@ -1,125 +1,148 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { code, memberRefkey, refkey } from "@alloy-js/core";
|
|
3
|
-
import { d } from "@alloy-js/core/testing";
|
|
2
|
+
import { code, memberRefkey, refkey, render } from "@alloy-js/core";
|
|
4
3
|
import { describe, expect, it } from "vitest";
|
|
5
4
|
import * as py from "../src/index.js";
|
|
6
5
|
import { ClassDeclaration, FunctionDeclaration, SourceFile, VariableDeclaration } from "../src/index.js";
|
|
7
|
-
import {
|
|
6
|
+
import { TestOutput, TestOutputDirectory } from "./utils.js";
|
|
8
7
|
it("renders basic member expression with dot notation", () => {
|
|
9
|
-
expect(
|
|
8
|
+
expect(_$createComponent(TestOutput, {
|
|
10
9
|
get children() {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
return _$createComponent(py.MemberExpression, {
|
|
11
|
+
get children() {
|
|
12
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
13
|
+
id: "obj"
|
|
14
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
15
|
+
id: "property"
|
|
16
|
+
})];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
16
19
|
}
|
|
17
|
-
})
|
|
20
|
+
})).toRenderTo(`
|
|
18
21
|
obj.property
|
|
19
22
|
`);
|
|
20
23
|
});
|
|
21
24
|
it("renders basic member expression with key", () => {
|
|
22
|
-
expect(
|
|
25
|
+
expect(_$createComponent(TestOutput, {
|
|
23
26
|
get children() {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
return _$createComponent(py.MemberExpression, {
|
|
28
|
+
get children() {
|
|
29
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
30
|
+
id: "arr"
|
|
31
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
32
|
+
key: 12345
|
|
33
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
34
|
+
id: "foo-bar"
|
|
35
|
+
})];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
31
38
|
}
|
|
32
|
-
})
|
|
39
|
+
})).toRenderTo(`
|
|
33
40
|
arr[12345].foo-bar
|
|
34
41
|
`);
|
|
35
42
|
});
|
|
36
43
|
it("renders basic member expression with key with reference", () => {
|
|
37
44
|
const rk1 = refkey();
|
|
38
|
-
expect(
|
|
45
|
+
expect(_$createComponent(TestOutput, {
|
|
39
46
|
get children() {
|
|
40
|
-
return
|
|
41
|
-
name: "test1",
|
|
42
|
-
refkey: rk1,
|
|
43
|
-
initializer: 1
|
|
44
|
-
}), _$createComponent(py.MemberExpression, {
|
|
47
|
+
return _$createComponent(py.StatementList, {
|
|
45
48
|
get children() {
|
|
46
|
-
return [_$createComponent(py.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}), _$createComponent(py.MemberExpression
|
|
51
|
-
|
|
49
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
50
|
+
name: "test1",
|
|
51
|
+
refkey: rk1,
|
|
52
|
+
initializer: 1
|
|
53
|
+
}), _$createComponent(py.MemberExpression, {
|
|
54
|
+
get children() {
|
|
55
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
56
|
+
id: "arr"
|
|
57
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
58
|
+
key: rk1
|
|
59
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
60
|
+
id: "foo-bar"
|
|
61
|
+
})];
|
|
62
|
+
}
|
|
52
63
|
})];
|
|
53
64
|
}
|
|
54
|
-
})
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
|
-
})
|
|
67
|
+
})).toRenderTo(`
|
|
57
68
|
test1 = 1
|
|
58
69
|
arr[test1].foo-bar
|
|
59
70
|
`);
|
|
60
71
|
});
|
|
61
72
|
it("renders basic member expression with keys", () => {
|
|
62
|
-
expect(
|
|
73
|
+
expect(_$createComponent(TestOutput, {
|
|
63
74
|
get children() {
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
return _$createComponent(py.MemberExpression, {
|
|
76
|
+
get children() {
|
|
77
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
78
|
+
id: "arr"
|
|
79
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
80
|
+
keys: [1, 2]
|
|
81
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
82
|
+
id: "foo-bar"
|
|
83
|
+
})];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
71
86
|
}
|
|
72
|
-
})
|
|
87
|
+
})).toRenderTo(`
|
|
73
88
|
arr[1, 2].foo-bar
|
|
74
89
|
`);
|
|
75
90
|
});
|
|
76
91
|
it("renders basic member expression with keys with references", () => {
|
|
77
92
|
const rk1 = refkey();
|
|
78
93
|
const rk2 = refkey();
|
|
79
|
-
expect(
|
|
94
|
+
expect(_$createComponent(TestOutput, {
|
|
80
95
|
get children() {
|
|
81
|
-
return
|
|
82
|
-
name: "test1",
|
|
83
|
-
refkey: rk1,
|
|
84
|
-
initializer: 1
|
|
85
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
86
|
-
name: "test2",
|
|
87
|
-
refkey: rk2,
|
|
88
|
-
initializer: 2
|
|
89
|
-
}), _$createComponent(py.MemberExpression, {
|
|
96
|
+
return _$createComponent(py.StatementList, {
|
|
90
97
|
get children() {
|
|
91
|
-
return [_$createComponent(py.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}), _$createComponent(py.
|
|
96
|
-
|
|
98
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
99
|
+
name: "test1",
|
|
100
|
+
refkey: rk1,
|
|
101
|
+
initializer: 1
|
|
102
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
103
|
+
name: "test2",
|
|
104
|
+
refkey: rk2,
|
|
105
|
+
initializer: 2
|
|
106
|
+
}), _$createComponent(py.MemberExpression, {
|
|
107
|
+
get children() {
|
|
108
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
109
|
+
id: "arr"
|
|
110
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
111
|
+
keys: [rk1, rk2]
|
|
112
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
113
|
+
id: "foo-bar"
|
|
114
|
+
})];
|
|
115
|
+
}
|
|
97
116
|
})];
|
|
98
117
|
}
|
|
99
|
-
})
|
|
118
|
+
});
|
|
100
119
|
}
|
|
101
|
-
})
|
|
120
|
+
})).toRenderTo(`
|
|
102
121
|
test1 = 1
|
|
103
122
|
test2 = 2
|
|
104
123
|
arr[test1, test2].foo-bar
|
|
105
124
|
`);
|
|
106
125
|
});
|
|
107
126
|
it("renders basic member expression with slice - 1", () => {
|
|
108
|
-
expect(
|
|
127
|
+
expect(_$createComponent(TestOutput, {
|
|
109
128
|
get children() {
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
return _$createComponent(py.MemberExpression, {
|
|
130
|
+
get children() {
|
|
131
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
132
|
+
id: "arr"
|
|
133
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
134
|
+
slice: {
|
|
135
|
+
start: 1,
|
|
136
|
+
stop: 3,
|
|
137
|
+
step: 2
|
|
138
|
+
}
|
|
139
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
140
|
+
id: "foo-bar"
|
|
141
|
+
})];
|
|
117
142
|
}
|
|
118
|
-
})
|
|
119
|
-
id: "foo-bar"
|
|
120
|
-
})];
|
|
143
|
+
});
|
|
121
144
|
}
|
|
122
|
-
})
|
|
145
|
+
})).toRenderTo(`
|
|
123
146
|
arr[1:3:2].foo-bar
|
|
124
147
|
`);
|
|
125
148
|
});
|
|
@@ -127,37 +150,41 @@ it("renders basic member expression with slice - 1 with references", () => {
|
|
|
127
150
|
const rk1 = refkey();
|
|
128
151
|
const rk2 = refkey();
|
|
129
152
|
const rk3 = refkey();
|
|
130
|
-
expect(
|
|
153
|
+
expect(_$createComponent(TestOutput, {
|
|
131
154
|
get children() {
|
|
132
|
-
return
|
|
133
|
-
name: "test1",
|
|
134
|
-
refkey: rk1,
|
|
135
|
-
initializer: 1
|
|
136
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
137
|
-
name: "test2",
|
|
138
|
-
refkey: rk2,
|
|
139
|
-
initializer: 3
|
|
140
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
141
|
-
name: "test3",
|
|
142
|
-
refkey: rk3,
|
|
143
|
-
initializer: 2
|
|
144
|
-
}), _$createComponent(py.MemberExpression, {
|
|
155
|
+
return _$createComponent(py.StatementList, {
|
|
145
156
|
get children() {
|
|
146
|
-
return [_$createComponent(py.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
158
|
+
name: "test1",
|
|
159
|
+
refkey: rk1,
|
|
160
|
+
initializer: 1
|
|
161
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
162
|
+
name: "test2",
|
|
163
|
+
refkey: rk2,
|
|
164
|
+
initializer: 3
|
|
165
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
166
|
+
name: "test3",
|
|
167
|
+
refkey: rk3,
|
|
168
|
+
initializer: 2
|
|
169
|
+
}), _$createComponent(py.MemberExpression, {
|
|
170
|
+
get children() {
|
|
171
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
172
|
+
id: "arr"
|
|
173
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
174
|
+
slice: {
|
|
175
|
+
start: rk1,
|
|
176
|
+
stop: rk2,
|
|
177
|
+
step: rk3
|
|
178
|
+
}
|
|
179
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
180
|
+
id: "foo-bar"
|
|
181
|
+
})];
|
|
153
182
|
}
|
|
154
|
-
}), _$createComponent(py.MemberExpression.Part, {
|
|
155
|
-
id: "foo-bar"
|
|
156
183
|
})];
|
|
157
184
|
}
|
|
158
|
-
})
|
|
185
|
+
});
|
|
159
186
|
}
|
|
160
|
-
})
|
|
187
|
+
})).toRenderTo(`
|
|
161
188
|
test1 = 1
|
|
162
189
|
test2 = 3
|
|
163
190
|
test3 = 2
|
|
@@ -165,229 +192,281 @@ it("renders basic member expression with slice - 1 with references", () => {
|
|
|
165
192
|
`);
|
|
166
193
|
});
|
|
167
194
|
it("renders basic member expression with slice - 2", () => {
|
|
168
|
-
expect(
|
|
195
|
+
expect(_$createComponent(TestOutput, {
|
|
169
196
|
get children() {
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
197
|
+
return _$createComponent(py.MemberExpression, {
|
|
198
|
+
get children() {
|
|
199
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
200
|
+
id: "arr"
|
|
201
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
202
|
+
slice: {
|
|
203
|
+
stop: 3
|
|
204
|
+
}
|
|
205
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
206
|
+
id: "foo-bar"
|
|
207
|
+
})];
|
|
175
208
|
}
|
|
176
|
-
})
|
|
177
|
-
id: "foo-bar"
|
|
178
|
-
})];
|
|
209
|
+
});
|
|
179
210
|
}
|
|
180
|
-
})
|
|
211
|
+
})).toRenderTo(`
|
|
181
212
|
arr[:3].foo-bar
|
|
182
213
|
`);
|
|
183
214
|
});
|
|
184
215
|
it("renders basic member expression with slice - 3", () => {
|
|
185
|
-
expect(
|
|
216
|
+
expect(_$createComponent(TestOutput, {
|
|
186
217
|
get children() {
|
|
187
|
-
return
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
218
|
+
return _$createComponent(py.MemberExpression, {
|
|
219
|
+
get children() {
|
|
220
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
221
|
+
id: "arr"
|
|
222
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
223
|
+
slice: {
|
|
224
|
+
step: 2
|
|
225
|
+
}
|
|
226
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
227
|
+
id: "foo-bar"
|
|
228
|
+
})];
|
|
192
229
|
}
|
|
193
|
-
})
|
|
194
|
-
id: "foo-bar"
|
|
195
|
-
})];
|
|
230
|
+
});
|
|
196
231
|
}
|
|
197
|
-
})
|
|
232
|
+
})).toRenderTo(`
|
|
198
233
|
arr[::2].foo-bar
|
|
199
234
|
`);
|
|
200
235
|
});
|
|
201
236
|
it("renders basic member expression with slice - 4", () => {
|
|
202
|
-
expect(
|
|
237
|
+
expect(_$createComponent(TestOutput, {
|
|
203
238
|
get children() {
|
|
204
|
-
return
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
239
|
+
return _$createComponent(py.MemberExpression, {
|
|
240
|
+
get children() {
|
|
241
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
242
|
+
id: "arr"
|
|
243
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
244
|
+
slice: {
|
|
245
|
+
start: 1
|
|
246
|
+
}
|
|
247
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
248
|
+
id: "foo-bar"
|
|
249
|
+
})];
|
|
209
250
|
}
|
|
210
|
-
})
|
|
211
|
-
id: "foo-bar"
|
|
212
|
-
})];
|
|
251
|
+
});
|
|
213
252
|
}
|
|
214
|
-
})
|
|
253
|
+
})).toRenderTo(`
|
|
215
254
|
arr[1:].foo-bar
|
|
216
255
|
`);
|
|
217
256
|
});
|
|
218
257
|
it("renders basic member expression with slice - 5", () => {
|
|
219
|
-
expect(
|
|
258
|
+
expect(_$createComponent(TestOutput, {
|
|
220
259
|
get children() {
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
260
|
+
return _$createComponent(py.MemberExpression, {
|
|
261
|
+
get children() {
|
|
262
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
263
|
+
id: "arr"
|
|
264
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
265
|
+
slice: {
|
|
266
|
+
start: 1,
|
|
267
|
+
step: 2
|
|
268
|
+
}
|
|
269
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
270
|
+
id: "foo-bar"
|
|
271
|
+
})];
|
|
227
272
|
}
|
|
228
|
-
})
|
|
229
|
-
id: "foo-bar"
|
|
230
|
-
})];
|
|
273
|
+
});
|
|
231
274
|
}
|
|
232
|
-
})
|
|
275
|
+
})).toRenderTo(`
|
|
233
276
|
arr[1::2].foo-bar
|
|
234
277
|
`);
|
|
235
278
|
});
|
|
236
279
|
it("renders basic member expression with an expression index - 1", () => {
|
|
237
280
|
const xRefkey = refkey();
|
|
238
|
-
expect(
|
|
281
|
+
expect(_$createComponent(TestOutput, {
|
|
239
282
|
get children() {
|
|
240
|
-
return
|
|
241
|
-
name: "x",
|
|
242
|
-
initializer: 1,
|
|
243
|
-
refkey: xRefkey
|
|
244
|
-
}), _$createComponent(py.MemberExpression, {
|
|
283
|
+
return _$createComponent(py.StatementList, {
|
|
245
284
|
get children() {
|
|
246
|
-
return [_$createComponent(py.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}), _$createComponent(py.MemberExpression
|
|
251
|
-
|
|
285
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
286
|
+
name: "x",
|
|
287
|
+
initializer: 1,
|
|
288
|
+
refkey: xRefkey
|
|
289
|
+
}), _$createComponent(py.MemberExpression, {
|
|
290
|
+
get children() {
|
|
291
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
292
|
+
id: "arr"
|
|
293
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
294
|
+
key: code`${xRefkey} + 1`
|
|
295
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
296
|
+
id: "foo-bar"
|
|
297
|
+
})];
|
|
298
|
+
}
|
|
252
299
|
})];
|
|
253
300
|
}
|
|
254
|
-
})
|
|
301
|
+
});
|
|
255
302
|
}
|
|
256
|
-
})
|
|
303
|
+
})).toRenderTo(`
|
|
257
304
|
x = 1
|
|
258
305
|
arr[x + 1].foo-bar
|
|
259
306
|
`);
|
|
260
307
|
});
|
|
261
308
|
it("renders basic member expression with an expression index - 2", () => {
|
|
262
|
-
expect(
|
|
309
|
+
expect(_$createComponent(TestOutput, {
|
|
263
310
|
get children() {
|
|
264
|
-
return _$createComponent(py.
|
|
311
|
+
return _$createComponent(py.StatementList, {
|
|
265
312
|
get children() {
|
|
266
|
-
return
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
313
|
+
return _$createComponent(py.MemberExpression, {
|
|
314
|
+
get children() {
|
|
315
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
316
|
+
id: "arr"
|
|
317
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
318
|
+
key: code`"foo" + 1`
|
|
319
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
320
|
+
id: "foo-bar"
|
|
321
|
+
})];
|
|
322
|
+
}
|
|
323
|
+
});
|
|
273
324
|
}
|
|
274
325
|
});
|
|
275
326
|
}
|
|
276
|
-
})
|
|
327
|
+
})).toRenderTo(`
|
|
277
328
|
arr["foo" + 1].foo-bar
|
|
278
329
|
`);
|
|
279
330
|
});
|
|
280
331
|
it("throws an error for invalid identifiers with quotes", () => {
|
|
281
|
-
expect(() =>
|
|
332
|
+
expect(() => render(_$createComponent(TestOutput, {
|
|
282
333
|
get children() {
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
334
|
+
return _$createComponent(py.MemberExpression, {
|
|
335
|
+
get children() {
|
|
336
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
337
|
+
id: "obj"
|
|
338
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
339
|
+
id: `property-"name"`
|
|
340
|
+
})];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
288
343
|
}
|
|
289
|
-
})
|
|
344
|
+
}))).toThrowError(/Invalid identifier: property-"name"/);
|
|
290
345
|
});
|
|
291
346
|
it("supports multiple levels of nesting", () => {
|
|
292
|
-
expect(
|
|
347
|
+
expect(_$createComponent(TestOutput, {
|
|
293
348
|
get children() {
|
|
294
|
-
return
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
349
|
+
return _$createComponent(py.MemberExpression, {
|
|
350
|
+
get children() {
|
|
351
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
352
|
+
id: "a"
|
|
353
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
354
|
+
id: "b"
|
|
355
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
356
|
+
id: "c"
|
|
357
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
358
|
+
id: "d"
|
|
359
|
+
})];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
303
362
|
}
|
|
304
|
-
})
|
|
363
|
+
})).toRenderTo(`
|
|
305
364
|
a.b.c.d
|
|
306
365
|
`);
|
|
307
366
|
});
|
|
308
367
|
it("handles a mix of dot and bracket notation", () => {
|
|
309
|
-
expect(
|
|
368
|
+
expect(_$createComponent(TestOutput, {
|
|
310
369
|
get children() {
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
370
|
+
return _$createComponent(py.MemberExpression, {
|
|
371
|
+
get children() {
|
|
372
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
373
|
+
id: "obj"
|
|
374
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
375
|
+
id: "normalProp"
|
|
376
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
377
|
+
key: "special-prop"
|
|
378
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
379
|
+
key: "123"
|
|
380
|
+
})];
|
|
381
|
+
}
|
|
382
|
+
});
|
|
320
383
|
}
|
|
321
|
-
})
|
|
384
|
+
})).toRenderTo(`
|
|
322
385
|
obj.normalProp["special-prop"]["123"]
|
|
323
386
|
`);
|
|
324
387
|
});
|
|
325
388
|
it("throws an error when providing conflicting part props", () => {
|
|
326
|
-
expect(() =>
|
|
389
|
+
expect(() => render(_$createComponent(TestOutput, {
|
|
327
390
|
get children() {
|
|
328
|
-
return
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
391
|
+
return _$createComponent(py.MemberExpression, {
|
|
392
|
+
get children() {
|
|
393
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
394
|
+
id: "obj"
|
|
395
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
396
|
+
id: "property",
|
|
397
|
+
args: [1, 2]
|
|
398
|
+
})];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
334
401
|
}
|
|
335
|
-
})
|
|
402
|
+
}))).toThrowError(`Only one of args, id can be used for a MemberExpression part at a time`);
|
|
336
403
|
});
|
|
337
404
|
it("throws an error when providing an empty slice", () => {
|
|
338
|
-
expect(() =>
|
|
405
|
+
expect(() => render(_$createComponent(TestOutput, {
|
|
339
406
|
get children() {
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
407
|
+
return _$createComponent(py.MemberExpression, {
|
|
408
|
+
get children() {
|
|
409
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
410
|
+
id: "obj"
|
|
411
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
412
|
+
slice: {}
|
|
413
|
+
})];
|
|
414
|
+
}
|
|
415
|
+
});
|
|
345
416
|
}
|
|
346
|
-
})
|
|
417
|
+
}))).toThrowError(`MemberExpression.Part: slice object cannot be empty`);
|
|
347
418
|
});
|
|
348
419
|
it("throws an error when providing an empty array", () => {
|
|
349
|
-
expect(() =>
|
|
350
|
-
get children() {
|
|
351
|
-
return [_$createComponent(py.MemberExpression.Part, {
|
|
352
|
-
id: "obj"
|
|
353
|
-
}), _$createComponent(py.MemberExpression.Part, {
|
|
354
|
-
keys: []
|
|
355
|
-
})];
|
|
356
|
-
}
|
|
357
|
-
})])).toThrowError(`MemberExpression.Part: keys array cannot be empty`);
|
|
358
|
-
});
|
|
359
|
-
it("takes children for the id part", () => {
|
|
360
|
-
expect(toSourceText([_$createComponent(py.StatementList, {
|
|
420
|
+
expect(() => render(_$createComponent(TestOutput, {
|
|
361
421
|
get children() {
|
|
362
|
-
return
|
|
422
|
+
return _$createComponent(py.MemberExpression, {
|
|
363
423
|
get children() {
|
|
364
424
|
return [_$createComponent(py.MemberExpression.Part, {
|
|
365
|
-
id: "
|
|
425
|
+
id: "obj"
|
|
366
426
|
}), _$createComponent(py.MemberExpression.Part, {
|
|
367
|
-
|
|
427
|
+
keys: []
|
|
368
428
|
})];
|
|
369
429
|
}
|
|
370
|
-
})
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}))).toThrowError(`MemberExpression.Part: keys array cannot be empty`);
|
|
433
|
+
});
|
|
434
|
+
it("takes children for the id part", () => {
|
|
435
|
+
expect(_$createComponent(TestOutput, {
|
|
436
|
+
get children() {
|
|
437
|
+
return _$createComponent(py.StatementList, {
|
|
371
438
|
get children() {
|
|
372
|
-
return [_$createComponent(py.MemberExpression
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}), _$createComponent(py.MemberExpression
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
439
|
+
return [_$createComponent(py.MemberExpression, {
|
|
440
|
+
get children() {
|
|
441
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
442
|
+
id: "child1"
|
|
443
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
444
|
+
key: "child1"
|
|
445
|
+
})];
|
|
446
|
+
}
|
|
447
|
+
}), _$createComponent(py.MemberExpression, {
|
|
448
|
+
get children() {
|
|
449
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
450
|
+
id: "child1"
|
|
451
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
452
|
+
key: "child2"
|
|
453
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
454
|
+
args: true
|
|
455
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
456
|
+
key: "child3"
|
|
457
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
458
|
+
args: true
|
|
459
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
460
|
+
key: code`"foo" + 1`
|
|
461
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
462
|
+
args: true
|
|
463
|
+
})];
|
|
464
|
+
}
|
|
386
465
|
})];
|
|
387
466
|
}
|
|
388
|
-
})
|
|
467
|
+
});
|
|
389
468
|
}
|
|
390
|
-
})
|
|
469
|
+
})).toRenderTo(`
|
|
391
470
|
child1["child1"]
|
|
392
471
|
child1["child2"]()["child3"]()["foo" + 1]()
|
|
393
472
|
`);
|
|
@@ -396,27 +475,31 @@ describe("with refkeys", () => {
|
|
|
396
475
|
it("handles symbols correctly", () => {
|
|
397
476
|
const rk1 = refkey();
|
|
398
477
|
const rk2 = refkey();
|
|
399
|
-
expect(
|
|
478
|
+
expect(_$createComponent(TestOutput, {
|
|
400
479
|
get children() {
|
|
401
|
-
return
|
|
402
|
-
name: "test1",
|
|
403
|
-
refkey: rk1,
|
|
404
|
-
initializer: 1
|
|
405
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
406
|
-
name: "test1",
|
|
407
|
-
refkey: rk2,
|
|
408
|
-
initializer: 2
|
|
409
|
-
}), _$createComponent(py.MemberExpression, {
|
|
480
|
+
return _$createComponent(py.StatementList, {
|
|
410
481
|
get children() {
|
|
411
|
-
return [_$createComponent(py.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
482
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
483
|
+
name: "test1",
|
|
484
|
+
refkey: rk1,
|
|
485
|
+
initializer: 1
|
|
486
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
487
|
+
name: "test1",
|
|
488
|
+
refkey: rk2,
|
|
489
|
+
initializer: 2
|
|
490
|
+
}), _$createComponent(py.MemberExpression, {
|
|
491
|
+
get children() {
|
|
492
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
493
|
+
refkey: rk1
|
|
494
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
495
|
+
refkey: rk2
|
|
496
|
+
})];
|
|
497
|
+
}
|
|
415
498
|
})];
|
|
416
499
|
}
|
|
417
|
-
})
|
|
500
|
+
});
|
|
418
501
|
}
|
|
419
|
-
})
|
|
502
|
+
})).toRenderTo(`
|
|
420
503
|
test1 = 1
|
|
421
504
|
test1_2_test = 2
|
|
422
505
|
test1.test1_2_test
|
|
@@ -488,7 +571,9 @@ describe("with refkeys", () => {
|
|
|
488
571
|
}), [_$memo(() => memberRefkey(v1Rk, classMethod1Ref))], [_$memo(() => memberRefkey(v2Rk, classMethod2Ref))]];
|
|
489
572
|
}
|
|
490
573
|
});
|
|
491
|
-
expect(
|
|
574
|
+
expect(_$createComponent(TestOutput, {
|
|
575
|
+
children: template
|
|
576
|
+
})).toRenderTo(`
|
|
492
577
|
class Model1:
|
|
493
578
|
foo: str
|
|
494
579
|
|
|
@@ -553,7 +638,9 @@ describe("with refkeys", () => {
|
|
|
553
638
|
})];
|
|
554
639
|
}
|
|
555
640
|
});
|
|
556
|
-
expect(
|
|
641
|
+
expect(_$createComponent(TestOutput, {
|
|
642
|
+
children: template
|
|
643
|
+
})).toRenderTo(`
|
|
557
644
|
class Model:
|
|
558
645
|
bar: str
|
|
559
646
|
|
|
@@ -570,61 +657,65 @@ describe("with refkeys", () => {
|
|
|
570
657
|
const classMethodRefkey = refkey();
|
|
571
658
|
const classMemberRefkey = refkey();
|
|
572
659
|
const instanceRefkey = refkey();
|
|
573
|
-
expect(
|
|
660
|
+
expect(_$createComponent(TestOutput, {
|
|
574
661
|
get children() {
|
|
575
|
-
return
|
|
576
|
-
name: "Bar",
|
|
577
|
-
refkey: interfaceRefkey,
|
|
578
|
-
get children() {
|
|
579
|
-
return _$createComponent(VariableDeclaration, {
|
|
580
|
-
name: "prop1",
|
|
581
|
-
refkey: interfaceMemberRefkey,
|
|
582
|
-
type: "str",
|
|
583
|
-
omitNone: true
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
}), _$createComponent(ClassDeclaration, {
|
|
587
|
-
name: "Foo",
|
|
588
|
-
refkey: classRefkey,
|
|
589
|
-
get children() {
|
|
590
|
-
return [_$createComponent(VariableDeclaration, {
|
|
591
|
-
name: "test1",
|
|
592
|
-
refkey: classMemberRefkey,
|
|
593
|
-
type: interfaceRefkey
|
|
594
|
-
}), _$createIntrinsic("br", {}), _$createComponent(FunctionDeclaration, {
|
|
595
|
-
name: "testMethod",
|
|
596
|
-
parameters: [],
|
|
597
|
-
refkey: classMethodRefkey,
|
|
598
|
-
returnType: interfaceRefkey
|
|
599
|
-
})];
|
|
600
|
-
}
|
|
601
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
602
|
-
name: "inst",
|
|
603
|
-
refkey: instanceRefkey,
|
|
604
|
-
initializer: code`${classRefkey}()`
|
|
605
|
-
}), _$createComponent(py.MemberExpression, {
|
|
606
|
-
get children() {
|
|
607
|
-
return [_$createComponent(py.MemberExpression.Part, {
|
|
608
|
-
refkey: instanceRefkey
|
|
609
|
-
}), _$createComponent(py.MemberExpression.Part, {
|
|
610
|
-
refkey: classMemberRefkey
|
|
611
|
-
}), _$createComponent(py.MemberExpression.Part, {
|
|
612
|
-
refkey: interfaceMemberRefkey
|
|
613
|
-
})];
|
|
614
|
-
}
|
|
615
|
-
}), _$createComponent(py.MemberExpression, {
|
|
662
|
+
return _$createComponent(py.StatementList, {
|
|
616
663
|
get children() {
|
|
617
|
-
return [_$createComponent(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
664
|
+
return [_$createComponent(ClassDeclaration, {
|
|
665
|
+
name: "Bar",
|
|
666
|
+
refkey: interfaceRefkey,
|
|
667
|
+
get children() {
|
|
668
|
+
return _$createComponent(VariableDeclaration, {
|
|
669
|
+
name: "prop1",
|
|
670
|
+
refkey: interfaceMemberRefkey,
|
|
671
|
+
type: "str",
|
|
672
|
+
omitNone: true
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}), _$createComponent(ClassDeclaration, {
|
|
676
|
+
name: "Foo",
|
|
677
|
+
refkey: classRefkey,
|
|
678
|
+
get children() {
|
|
679
|
+
return [_$createComponent(VariableDeclaration, {
|
|
680
|
+
name: "test1",
|
|
681
|
+
refkey: classMemberRefkey,
|
|
682
|
+
type: interfaceRefkey
|
|
683
|
+
}), _$createIntrinsic("br", {}), _$createComponent(FunctionDeclaration, {
|
|
684
|
+
name: "testMethod",
|
|
685
|
+
parameters: [],
|
|
686
|
+
refkey: classMethodRefkey,
|
|
687
|
+
returnType: interfaceRefkey
|
|
688
|
+
})];
|
|
689
|
+
}
|
|
690
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
691
|
+
name: "inst",
|
|
692
|
+
refkey: instanceRefkey,
|
|
693
|
+
initializer: code`${classRefkey}()`
|
|
694
|
+
}), _$createComponent(py.MemberExpression, {
|
|
695
|
+
get children() {
|
|
696
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
697
|
+
refkey: instanceRefkey
|
|
698
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
699
|
+
refkey: classMemberRefkey
|
|
700
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
701
|
+
refkey: interfaceMemberRefkey
|
|
702
|
+
})];
|
|
703
|
+
}
|
|
704
|
+
}), _$createComponent(py.MemberExpression, {
|
|
705
|
+
get children() {
|
|
706
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
707
|
+
refkey: instanceRefkey
|
|
708
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
709
|
+
refkey: classMethodRefkey
|
|
710
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
711
|
+
args: []
|
|
712
|
+
})];
|
|
713
|
+
}
|
|
623
714
|
})];
|
|
624
715
|
}
|
|
625
|
-
})
|
|
716
|
+
});
|
|
626
717
|
}
|
|
627
|
-
})
|
|
718
|
+
})).toRenderTo(`
|
|
628
719
|
class Bar:
|
|
629
720
|
prop1: str
|
|
630
721
|
|
|
@@ -642,27 +733,31 @@ describe("with refkeys", () => {
|
|
|
642
733
|
it("handles late resolved refkeys correctly", () => {
|
|
643
734
|
const rk1 = refkey();
|
|
644
735
|
const rk2 = refkey();
|
|
645
|
-
expect(
|
|
736
|
+
expect(_$createComponent(TestOutput, {
|
|
646
737
|
get children() {
|
|
647
|
-
return
|
|
738
|
+
return _$createComponent(py.StatementList, {
|
|
648
739
|
get children() {
|
|
649
|
-
return [_$createComponent(py.MemberExpression
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
740
|
+
return [_$createComponent(py.MemberExpression, {
|
|
741
|
+
get children() {
|
|
742
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
743
|
+
refkey: rk1
|
|
744
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
745
|
+
refkey: rk2
|
|
746
|
+
})];
|
|
747
|
+
}
|
|
748
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
749
|
+
name: "test1",
|
|
750
|
+
refkey: rk1,
|
|
751
|
+
initializer: 1
|
|
752
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
753
|
+
name: "test1",
|
|
754
|
+
refkey: rk2,
|
|
755
|
+
initializer: 2
|
|
653
756
|
})];
|
|
654
757
|
}
|
|
655
|
-
})
|
|
656
|
-
name: "test1",
|
|
657
|
-
refkey: rk1,
|
|
658
|
-
initializer: 1
|
|
659
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
660
|
-
name: "test1",
|
|
661
|
-
refkey: rk2,
|
|
662
|
-
initializer: 2
|
|
663
|
-
})];
|
|
758
|
+
});
|
|
664
759
|
}
|
|
665
|
-
})
|
|
760
|
+
})).toRenderTo(`
|
|
666
761
|
test1.test1_2_test
|
|
667
762
|
test1 = 1
|
|
668
763
|
test1_2_test = 2
|
|
@@ -670,132 +765,156 @@ describe("with refkeys", () => {
|
|
|
670
765
|
});
|
|
671
766
|
it("creates a full reference to the first refkey", () => {
|
|
672
767
|
const rk1 = refkey();
|
|
673
|
-
|
|
674
|
-
path: "source.py",
|
|
675
|
-
get children() {
|
|
676
|
-
return _$createComponent(py.VariableDeclaration, {
|
|
677
|
-
name: "importMe",
|
|
678
|
-
refkey: rk1
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
}), _$createComponent(SourceFile, {
|
|
682
|
-
path: "index.py",
|
|
768
|
+
expect(_$createComponent(TestOutputDirectory, {
|
|
683
769
|
get children() {
|
|
684
|
-
return _$createComponent(
|
|
770
|
+
return [_$createComponent(SourceFile, {
|
|
771
|
+
path: "source.py",
|
|
685
772
|
get children() {
|
|
686
|
-
return _$createComponent(py.
|
|
773
|
+
return _$createComponent(py.VariableDeclaration, {
|
|
774
|
+
name: "importMe",
|
|
775
|
+
refkey: rk1
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}), _$createComponent(SourceFile, {
|
|
779
|
+
path: "index.py",
|
|
780
|
+
get children() {
|
|
781
|
+
return _$createComponent(py.StatementList, {
|
|
687
782
|
get children() {
|
|
688
|
-
return
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
783
|
+
return _$createComponent(py.MemberExpression, {
|
|
784
|
+
get children() {
|
|
785
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
786
|
+
refkey: rk1
|
|
787
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
788
|
+
id: "foo"
|
|
789
|
+
})];
|
|
790
|
+
}
|
|
791
|
+
});
|
|
693
792
|
}
|
|
694
793
|
});
|
|
695
794
|
}
|
|
696
|
-
});
|
|
795
|
+
})];
|
|
697
796
|
}
|
|
698
|
-
})
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
from source import import_me
|
|
797
|
+
})).toRenderTo({
|
|
798
|
+
"index.py": `
|
|
799
|
+
from source import import_me
|
|
702
800
|
|
|
703
|
-
|
|
704
|
-
|
|
801
|
+
import_me.foo
|
|
802
|
+
`,
|
|
803
|
+
"source.py": "import_me = None"
|
|
705
804
|
});
|
|
706
805
|
});
|
|
707
806
|
});
|
|
708
807
|
describe("with function calls", () => {
|
|
709
808
|
it("handles simple function calls correctly", () => {
|
|
710
|
-
expect(
|
|
809
|
+
expect(_$createComponent(TestOutput, {
|
|
711
810
|
get children() {
|
|
712
|
-
return
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
811
|
+
return _$createComponent(py.MemberExpression, {
|
|
812
|
+
get children() {
|
|
813
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
814
|
+
id: "myFunction"
|
|
815
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
816
|
+
args: [1, 2]
|
|
817
|
+
})];
|
|
818
|
+
}
|
|
819
|
+
});
|
|
717
820
|
}
|
|
718
|
-
})
|
|
821
|
+
})).toRenderTo(`
|
|
719
822
|
myFunction(1, 2)
|
|
720
823
|
`);
|
|
721
824
|
});
|
|
722
825
|
it("handles function calls with references correctly", () => {
|
|
723
826
|
const xRefkey = refkey();
|
|
724
827
|
const yRefkey = refkey();
|
|
725
|
-
expect(
|
|
828
|
+
expect(_$createComponent(TestOutput, {
|
|
726
829
|
get children() {
|
|
727
|
-
return
|
|
728
|
-
name: "x",
|
|
729
|
-
initializer: 1,
|
|
730
|
-
refkey: xRefkey
|
|
731
|
-
}), _$createComponent(py.VariableDeclaration, {
|
|
732
|
-
name: "y",
|
|
733
|
-
initializer: 2,
|
|
734
|
-
refkey: yRefkey
|
|
735
|
-
}), _$createComponent(py.MemberExpression, {
|
|
830
|
+
return _$createComponent(py.StatementList, {
|
|
736
831
|
get children() {
|
|
737
|
-
return [_$createComponent(py.
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
832
|
+
return [_$createComponent(py.VariableDeclaration, {
|
|
833
|
+
name: "x",
|
|
834
|
+
initializer: 1,
|
|
835
|
+
refkey: xRefkey
|
|
836
|
+
}), _$createComponent(py.VariableDeclaration, {
|
|
837
|
+
name: "y",
|
|
838
|
+
initializer: 2,
|
|
839
|
+
refkey: yRefkey
|
|
840
|
+
}), _$createComponent(py.MemberExpression, {
|
|
841
|
+
get children() {
|
|
842
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
843
|
+
id: "myFunction"
|
|
844
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
845
|
+
args: [xRefkey, yRefkey]
|
|
846
|
+
})];
|
|
847
|
+
}
|
|
741
848
|
})];
|
|
742
849
|
}
|
|
743
|
-
})
|
|
850
|
+
});
|
|
744
851
|
}
|
|
745
|
-
})
|
|
852
|
+
})).toRenderTo(`
|
|
746
853
|
x = 1
|
|
747
854
|
y = 2
|
|
748
855
|
myFunction(x, y)
|
|
749
856
|
`);
|
|
750
857
|
});
|
|
751
858
|
it("handles method calls correctly", () => {
|
|
752
|
-
expect(
|
|
859
|
+
expect(_$createComponent(TestOutput, {
|
|
753
860
|
get children() {
|
|
754
|
-
return
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
861
|
+
return _$createComponent(py.MemberExpression, {
|
|
862
|
+
get children() {
|
|
863
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
864
|
+
id: "method1"
|
|
865
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
866
|
+
args: [1, 2]
|
|
867
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
868
|
+
args: []
|
|
869
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
870
|
+
id: "method2"
|
|
871
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
872
|
+
args: []
|
|
873
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
874
|
+
id: "prop"
|
|
875
|
+
})];
|
|
876
|
+
}
|
|
877
|
+
});
|
|
767
878
|
}
|
|
768
|
-
})
|
|
879
|
+
})).toRenderTo(`
|
|
769
880
|
method1(1, 2)().method2().prop
|
|
770
881
|
`);
|
|
771
882
|
});
|
|
772
883
|
it("handles function calls correctly", () => {
|
|
773
|
-
expect(
|
|
884
|
+
expect(_$createComponent(TestOutput, {
|
|
774
885
|
get children() {
|
|
775
|
-
return
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
886
|
+
return _$createComponent(py.MemberExpression, {
|
|
887
|
+
get children() {
|
|
888
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
889
|
+
id: "myFunction"
|
|
890
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
891
|
+
args: [1, 2]
|
|
892
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
893
|
+
id: "prop"
|
|
894
|
+
})];
|
|
895
|
+
}
|
|
896
|
+
});
|
|
782
897
|
}
|
|
783
|
-
})
|
|
898
|
+
})).toRenderTo(`
|
|
784
899
|
myFunction(1, 2).prop
|
|
785
900
|
`);
|
|
786
901
|
});
|
|
787
902
|
it("handles function calls correctly", () => {
|
|
788
|
-
expect(
|
|
903
|
+
expect(_$createComponent(TestOutput, {
|
|
789
904
|
get children() {
|
|
790
|
-
return
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
905
|
+
return _$createComponent(py.MemberExpression, {
|
|
906
|
+
get children() {
|
|
907
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
908
|
+
id: "myFunction"
|
|
909
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
910
|
+
args: [1, 2]
|
|
911
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
912
|
+
id: "prop"
|
|
913
|
+
})];
|
|
914
|
+
}
|
|
915
|
+
});
|
|
797
916
|
}
|
|
798
|
-
})
|
|
917
|
+
})).toRenderTo(`
|
|
799
918
|
myFunction(1, 2).prop
|
|
800
919
|
`);
|
|
801
920
|
});
|
|
@@ -803,75 +922,85 @@ describe("with function calls", () => {
|
|
|
803
922
|
describe("formatting", () => {
|
|
804
923
|
describe("simple chains", () => {
|
|
805
924
|
it("just dots", () => {
|
|
806
|
-
expect(
|
|
925
|
+
expect(_$createComponent(TestOutput, {
|
|
807
926
|
get children() {
|
|
808
|
-
return
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
927
|
+
return _$createComponent(py.MemberExpression, {
|
|
928
|
+
get children() {
|
|
929
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
930
|
+
id: "four"
|
|
931
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
932
|
+
id: "four"
|
|
933
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
934
|
+
id: "two"
|
|
935
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
936
|
+
id: "two"
|
|
937
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
938
|
+
id: "two"
|
|
939
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
940
|
+
id: "two"
|
|
941
|
+
})];
|
|
942
|
+
}
|
|
943
|
+
});
|
|
825
944
|
}
|
|
826
|
-
})).
|
|
945
|
+
})).toRenderTo(`
|
|
827
946
|
four.four \\
|
|
828
947
|
.two.two \\
|
|
829
948
|
.two.two
|
|
830
|
-
|
|
949
|
+
`, {
|
|
950
|
+
tabWidth: 4,
|
|
951
|
+
printWidth: 14
|
|
952
|
+
});
|
|
831
953
|
});
|
|
832
954
|
it("bracket breaks", () => {
|
|
833
|
-
expect(
|
|
955
|
+
expect(_$createComponent(TestOutput, {
|
|
834
956
|
get children() {
|
|
835
|
-
return
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
957
|
+
return _$createComponent(py.MemberExpression, {
|
|
958
|
+
get children() {
|
|
959
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
960
|
+
id: "obj"
|
|
961
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
962
|
+
key: "property-name"
|
|
963
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
964
|
+
id: "prop"
|
|
965
|
+
})];
|
|
966
|
+
}
|
|
967
|
+
});
|
|
846
968
|
}
|
|
847
|
-
})).
|
|
969
|
+
})).toRenderTo(`
|
|
848
970
|
obj[
|
|
849
971
|
"property-name"
|
|
850
972
|
].prop
|
|
851
|
-
|
|
973
|
+
`, {
|
|
974
|
+
tabWidth: 4,
|
|
975
|
+
printWidth: 12
|
|
976
|
+
});
|
|
852
977
|
});
|
|
853
978
|
});
|
|
854
979
|
describe("call chains", () => {
|
|
855
980
|
it("renders multiple calls on the same line when there are no breaks and they fit", () => {
|
|
856
|
-
expect(
|
|
981
|
+
expect(_$createComponent(TestOutput, {
|
|
857
982
|
get children() {
|
|
858
|
-
return
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
983
|
+
return _$createComponent(py.MemberExpression, {
|
|
984
|
+
get children() {
|
|
985
|
+
return [_$createComponent(py.MemberExpression.Part, {
|
|
986
|
+
id: "z"
|
|
987
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
988
|
+
id: "object"
|
|
989
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
990
|
+
args: true
|
|
991
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
992
|
+
id: "partial"
|
|
993
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
994
|
+
args: true
|
|
995
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
996
|
+
id: "optional"
|
|
997
|
+
}), _$createComponent(py.MemberExpression.Part, {
|
|
998
|
+
args: true
|
|
999
|
+
})];
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
873
1002
|
}
|
|
874
|
-
})
|
|
1003
|
+
})).toRenderTo(`
|
|
875
1004
|
z.object().partial().optional()
|
|
876
1005
|
`);
|
|
877
1006
|
});
|