|
1 | 1 | namespace ts {
|
2 | 2 | describe("FactoryAPI", () => {
|
| 3 | + describe("createExportAssignment", () => { |
| 4 | + it("parenthesizes default export if necessary", () => { |
| 5 | + function checkExpression(expression: Expression) { |
| 6 | + const node = createExportAssignment( |
| 7 | + /*decorators*/ undefined, |
| 8 | + /*modifiers*/ undefined, |
| 9 | + /*isExportEquals*/ false, |
| 10 | + expression, |
| 11 | + ); |
| 12 | + assert.strictEqual(node.expression.kind, SyntaxKind.ParenthesizedExpression); |
| 13 | + } |
| 14 | + |
| 15 | + const clazz = createClassExpression(/*modifiers*/ undefined, "C", /*typeParameters*/ undefined, /*heritageClauses*/ undefined, [ |
| 16 | + createProperty(/*decorators*/ undefined, [createToken(SyntaxKind.StaticKeyword)], "prop", /*questionOrExclamationToken*/ undefined, /*type*/ undefined, createLiteral("1")), |
| 17 | + ]); |
| 18 | + checkExpression(clazz); |
| 19 | + checkExpression(createPropertyAccess(clazz, "prop")); |
| 20 | + |
| 21 | + const func = createFunctionExpression(/*modifiers*/ undefined, /*asteriskToken*/ undefined, "fn", /*typeParameters*/ undefined, /*parameters*/ undefined, /*type*/ undefined, createBlock([])); |
| 22 | + checkExpression(func); |
| 23 | + checkExpression(createCall(func, /*typeArguments*/ undefined, /*argumentsArray*/ undefined)); |
| 24 | + |
| 25 | + checkExpression(createBinary(createLiteral("a"), SyntaxKind.CommaToken, createLiteral("b"))); |
| 26 | + checkExpression(createCommaList([createLiteral("a"), createLiteral("b")])); |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
3 | 30 | describe("createArrowFunction", () => {
|
4 | 31 | it("parenthesizes concise body if necessary", () => {
|
5 | 32 | function checkBody(body: ConciseBody) {
|
|
0 commit comments