prettier-plugin-java 2.4.0 → 2.5.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.
- package/dist/options.js +3 -4
- package/dist/printers/blocks-and-statements.js +20 -42
- package/dist/printers/classes.js +3 -0
- package/dist/printers/expressions.js +12 -6
- package/package.json +3 -3
- package/dist/src/base-cst-printer.js +0 -77
- package/dist/src/cst-printer.js +0 -37
- package/dist/src/index.js +0 -67
- package/dist/src/options.js +0 -256
- package/dist/src/parser.js +0 -7
- package/dist/src/printer.js +0 -28
- package/dist/src/printers/arrays.js +0 -49
- package/dist/src/printers/blocks-and-statements.js +0 -493
- package/dist/src/printers/classes.js +0 -724
- package/dist/src/printers/comments/comments-utils.js +0 -29
- package/dist/src/printers/comments/format-comments.js +0 -187
- package/dist/src/printers/comments/handle-comments.js +0 -38
- package/dist/src/printers/expressions.js +0 -549
- package/dist/src/printers/interfaces.js +0 -251
- package/dist/src/printers/lexical-structure.js +0 -43
- package/dist/src/printers/names.js +0 -53
- package/dist/src/printers/packages-and-modules.js +0 -185
- package/dist/src/printers/prettier-builder.js +0 -47
- package/dist/src/printers/printer-utils.js +0 -577
- package/dist/src/printers/types-values-and-variables.js +0 -183
- package/dist/src/types/utils.js +0 -29
- package/dist/src/utils/expressions-utils.js +0 -29
- package/dist/src/utils/index.js +0 -10
- package/dist/src/utils/printArgumentListWithBraces.js +0 -21
- package/dist/src/utils/printSingleLambdaInvocation.js +0 -20
- package/dist/test/babel-register.js +0 -3
- package/dist/test/repository-test/core-test.js +0 -12
- package/dist/test/repository-test/jhipster-1-test.js +0 -17
- package/dist/test/repository-test/jhipster-2-test.js +0 -16
- package/dist/test/test-utils.js +0 -215
- package/dist/test/unit-test/annotation_type_declaration/annotation_type_declaration-spec.js +0 -6
- package/dist/test/unit-test/args/args-spec.js +0 -6
- package/dist/test/unit-test/assert/assert-spec.js +0 -6
- package/dist/test/unit-test/binary_expressions/binary_expressions-spec.js +0 -6
- package/dist/test/unit-test/blank_lines/blank_lines-spec.js +0 -6
- package/dist/test/unit-test/bug-fixes/bug-fixes-spec.js +0 -6
- package/dist/test/unit-test/cast/cast-spec.js +0 -6
- package/dist/test/unit-test/char_literal/char_literal-spec.js +0 -6
- package/dist/test/unit-test/classes/multiple_classes-spec.js +0 -6
- package/dist/test/unit-test/comments/comments-spec.js +0 -14
- package/dist/test/unit-test/complex_generic_class/complex_generic_class-spec.js +0 -6
- package/dist/test/unit-test/constructors/constructors-spec.js +0 -6
- package/dist/test/unit-test/empty_statement/empty_statement-spec.js +0 -6
- package/dist/test/unit-test/enum/enum-spec.js +0 -6
- package/dist/test/unit-test/expressions/expressions-spec.js +0 -6
- package/dist/test/unit-test/extends_abstract_class/extends_abstract_class-spec.js +0 -6
- package/dist/test/unit-test/extends_abstract_class_and_implements_interfaces/extends_abstract_class_and_implements_interfaces-spec.js +0 -6
- package/dist/test/unit-test/for/for-spec.js +0 -6
- package/dist/test/unit-test/generic_class/generic_class-spec.js +0 -6
- package/dist/test/unit-test/generic_questionmark/generic_questionmark-spec.js +0 -6
- package/dist/test/unit-test/hello-world/hello-word-spec.js +0 -6
- package/dist/test/unit-test/if/if-spec.js +0 -6
- package/dist/test/unit-test/indent/indent-spec.js +0 -6
- package/dist/test/unit-test/instantiation/instantiation-spec.js +0 -6
- package/dist/test/unit-test/interface/interface-spec.js +0 -6
- package/dist/test/unit-test/lambda/lambda-spec.js +0 -6
- package/dist/test/unit-test/marker_annotations/marker_annotations-spec.js +0 -6
- package/dist/test/unit-test/member_chain/member_chain-spec.js +0 -6
- package/dist/test/unit-test/method_reference/method_reference-spec.js +0 -6
- package/dist/test/unit-test/modifiers/modifiers-spec.js +0 -6
- package/dist/test/unit-test/modules/modules-spec.js +0 -6
- package/dist/test/unit-test/package_and_imports/package_and_imports-spec.js +0 -34
- package/dist/test/unit-test/pattern-matching/pattern-matching-spec.js +0 -6
- package/dist/test/unit-test/prettier-ignore/prettier-ignore-spec.js +0 -28
- package/dist/test/unit-test/records/records-spec.js +0 -6
- package/dist/test/unit-test/return/return-spec.js +0 -6
- package/dist/test/unit-test/sealed/sealed-spec.js +0 -6
- package/dist/test/unit-test/snippets/arrays/array-initializer.spec.js +0 -94
- package/dist/test/unit-test/snippets/arrays/variable-initializer-list.spec.js +0 -19
- package/dist/test/unit-test/snippets/blocks-and-statements/switch.spec.js +0 -26
- package/dist/test/unit-test/snippets/classes/class-body.spec.js +0 -181
- package/dist/test/unit-test/snippets/classes/enum-body.spec.js +0 -87
- package/dist/test/unit-test/snippets/classes/variableDeclarator/test.spec.js +0 -186
- package/dist/test/unit-test/snippets/interfaces/element-value-array-initializer.spec.js +0 -85
- package/dist/test/unit-test/snippets/names/ambiguousName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/names/expressionName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/names/methodName/test.spec.js +0 -12
- package/dist/test/unit-test/snippets/names/packageOrTypeName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/types-values-and-variables/floatingPointType/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/types-values-and-variables/integralType/test.spec.js +0 -40
- package/dist/test/unit-test/snippets/types-values-and-variables/numericType/test.spec.js +0 -88
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcard/test.spec.js +0 -112
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcardBounds/test.spec.js +0 -81
- package/dist/test/unit-test/switch/switch-spec.js +0 -6
- package/dist/test/unit-test/synchronized/synchronized-spec.js +0 -6
- package/dist/test/unit-test/text-blocks/text-block-spec.js +0 -6
- package/dist/test/unit-test/throws/throws-spec.js +0 -6
- package/dist/test/unit-test/try_catch/try_catch-spec.js +0 -6
- package/dist/test/unit-test/types/types-spec.js +0 -6
- package/dist/test/unit-test/variables/variables-spec.js +0 -6
- package/dist/test/unit-test/while/while-spec.js +0 -6
- package/dist/test/unit-test/yield-statement/yield-statement-spec.js +0 -6
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
var test_utils_1 = require("../../test-utils");
|
|
23
|
-
var path = __importStar(require("path"));
|
|
24
|
-
describe("prettier-java", function () {
|
|
25
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classWithMixedCaseImports"));
|
|
26
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classWithMixedImports"));
|
|
27
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classWithNoImports"));
|
|
28
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classWithOnlyStaticImports"));
|
|
29
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classWithOnlyNonStaticImports"));
|
|
30
|
-
test_utils_1.testSample(path.resolve(__dirname, "./moduleWithMixedImports"));
|
|
31
|
-
test_utils_1.testSample(path.resolve(__dirname, "./moduleWithNoImports"));
|
|
32
|
-
test_utils_1.testSample(path.resolve(__dirname, "./moduleWithOnlyStaticImports"));
|
|
33
|
-
test_utils_1.testSample(path.resolve(__dirname, "./moduleWithOnlyNonStaticImports"));
|
|
34
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
var test_utils_1 = require("../../test-utils");
|
|
23
|
-
var path = __importStar(require("path"));
|
|
24
|
-
describe("prettier-java: try catch", function () {
|
|
25
|
-
test_utils_1.testSample(path.resolve(__dirname, "./classDeclaration"));
|
|
26
|
-
test_utils_1.testSample(path.resolve(__dirname, "./method"));
|
|
27
|
-
test_utils_1.testSample(path.resolve(__dirname, "./multiple-ignore"));
|
|
28
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var test_utils_1 = require("../../../test-utils");
|
|
4
|
-
describe("Arrays Initializer", function () {
|
|
5
|
-
it("can format an empty arrayInitializer", function () {
|
|
6
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
7
|
-
snippet: "{ }",
|
|
8
|
-
expectedOutput: "{}",
|
|
9
|
-
entryPoint: "arrayInitializer"
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
it("can format a arrayInitializer", function () {
|
|
13
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
14
|
-
snippet: "{alpha}",
|
|
15
|
-
expectedOutput: "{ alpha }",
|
|
16
|
-
entryPoint: "arrayInitializer"
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe("Trailing Commas", function () {
|
|
20
|
-
it("should remove extra comma in arrayInitializer by default", function () {
|
|
21
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
22
|
-
snippet: "{alpha,}",
|
|
23
|
-
expectedOutput: "{ alpha }",
|
|
24
|
-
entryPoint: "arrayInitializer"
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
it("should remove extra comma in arrayInitializer by default", function () {
|
|
28
|
-
var snippet = "{oneVeryLongArrayValue,}";
|
|
29
|
-
var prettierOptions = {
|
|
30
|
-
printWidth: 15
|
|
31
|
-
};
|
|
32
|
-
// prettier-ignore
|
|
33
|
-
var expectedOutput = "{\n" +
|
|
34
|
-
" oneVeryLongArrayValue\n" +
|
|
35
|
-
"}";
|
|
36
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
37
|
-
snippet: snippet,
|
|
38
|
-
expectedOutput: expectedOutput,
|
|
39
|
-
entryPoint: "arrayInitializer",
|
|
40
|
-
prettierOptions: prettierOptions
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
it("should remove extra comma in arrayInitializer if it fit in one line and --trailing-comma='all'", function () {
|
|
44
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
45
|
-
snippet: "{oneVeryLongArrayValue,}",
|
|
46
|
-
expectedOutput: "{ oneVeryLongArrayValue }",
|
|
47
|
-
entryPoint: "arrayInitializer",
|
|
48
|
-
prettierOptions: {
|
|
49
|
-
trailingComma: "all"
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
it("should not add extra comma in arrayInitializer if it fit in one line and --trailing-comma='all'", function () {
|
|
54
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
55
|
-
snippet: "{oneVeryLongArrayValue}",
|
|
56
|
-
expectedOutput: "{ oneVeryLongArrayValue }",
|
|
57
|
-
entryPoint: "arrayInitializer",
|
|
58
|
-
prettierOptions: {
|
|
59
|
-
trailingComma: "all"
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
it("should keep extra comma in arrayInitializer if it does not fit in one line and --trailing-comma='all'", function () {
|
|
64
|
-
// prettier-ignore
|
|
65
|
-
var expectedOutput = "{\n" +
|
|
66
|
-
" oneVeryLongArrayValue/* COMMA */,\n" +
|
|
67
|
-
"}";
|
|
68
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
69
|
-
snippet: "{oneVeryLongArrayValue /* COMMA */,}",
|
|
70
|
-
expectedOutput: expectedOutput,
|
|
71
|
-
entryPoint: "arrayInitializer",
|
|
72
|
-
prettierOptions: {
|
|
73
|
-
printWidth: 15,
|
|
74
|
-
trailingComma: "all"
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
it("should add extra comma in arrayInitializer if it does not fit in one line and --trailing-comma='all'", function () {
|
|
79
|
-
// prettier-ignore
|
|
80
|
-
var expectedOutput = "{\n" +
|
|
81
|
-
" oneVeryLongArrayValue,\n" +
|
|
82
|
-
"}";
|
|
83
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
84
|
-
snippet: "{oneVeryLongArrayValue}",
|
|
85
|
-
expectedOutput: expectedOutput,
|
|
86
|
-
entryPoint: "arrayInitializer",
|
|
87
|
-
prettierOptions: {
|
|
88
|
-
printWidth: 15,
|
|
89
|
-
trailingComma: "all"
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var test_utils_1 = require("../../../test-utils");
|
|
4
|
-
describe("VariableInitializerList", function () {
|
|
5
|
-
it("format variableInitializerList with one variableInitializer", function () {
|
|
6
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
7
|
-
snippet: "alpha ",
|
|
8
|
-
expectedOutput: "alpha",
|
|
9
|
-
entryPoint: "variableInitializerList"
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
it("format variableInitializerList with multiple variableInitializer", function () {
|
|
13
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
14
|
-
snippet: "alpha,beta, gamma",
|
|
15
|
-
expectedOutput: "alpha,\nbeta,\ngamma",
|
|
16
|
-
entryPoint: "variableInitializerList"
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var test_utils_1 = require("../../../test-utils");
|
|
4
|
-
describe("Switches", function () {
|
|
5
|
-
describe("Switch Statement", function () {
|
|
6
|
-
it("should format switch statement", function () {
|
|
7
|
-
var snippet = "switch (answer) {\n" +
|
|
8
|
-
" case YES:\n" +
|
|
9
|
-
' return "Yes";\n' +
|
|
10
|
-
" default:\n" +
|
|
11
|
-
' return "NO";\n' +
|
|
12
|
-
"}";
|
|
13
|
-
var expectedOutput = "switch (answer) {\n" +
|
|
14
|
-
" case YES:\n" +
|
|
15
|
-
' return "Yes";\n' +
|
|
16
|
-
" default:\n" +
|
|
17
|
-
' return "NO";\n' +
|
|
18
|
-
"}";
|
|
19
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
20
|
-
snippet: snippet,
|
|
21
|
-
expectedOutput: expectedOutput,
|
|
22
|
-
entryPoint: "switchStatement"
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var test_utils_1 = require("../../../test-utils");
|
|
4
|
-
describe("Class Body", function () {
|
|
5
|
-
it("should handle an empty class body", function () {
|
|
6
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
7
|
-
snippet: "{ }",
|
|
8
|
-
expectedOutput: "{}",
|
|
9
|
-
entryPoint: "classBody"
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
it("should handle a class body with one field declaration", function () {
|
|
13
|
-
// prettier-ignore
|
|
14
|
-
var expectedOutput = "{\n" +
|
|
15
|
-
" int i;\n" +
|
|
16
|
-
"}";
|
|
17
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
18
|
-
snippet: "{int i;}",
|
|
19
|
-
expectedOutput: expectedOutput,
|
|
20
|
-
entryPoint: "classBody"
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it("should handle blank lines between field declarations", function () {
|
|
24
|
-
// prettier-ignore
|
|
25
|
-
var snippet = "{\n" +
|
|
26
|
-
" int i;\n" +
|
|
27
|
-
" int j;\n" +
|
|
28
|
-
" \n" +
|
|
29
|
-
" int k;\n" +
|
|
30
|
-
"}";
|
|
31
|
-
// prettier-ignore
|
|
32
|
-
var expectedOutput = "{\n" +
|
|
33
|
-
" int i;\n" +
|
|
34
|
-
" int j;\n" +
|
|
35
|
-
"\n" +
|
|
36
|
-
" int k;\n" +
|
|
37
|
-
"}";
|
|
38
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
39
|
-
snippet: snippet,
|
|
40
|
-
expectedOutput: expectedOutput,
|
|
41
|
-
entryPoint: "classBody"
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
it("should add exactly one blank lines between field declarations", function () {
|
|
45
|
-
// prettier-ignore
|
|
46
|
-
var snippet = "{\n" +
|
|
47
|
-
" int i;\n" +
|
|
48
|
-
"\n" +
|
|
49
|
-
"\n" +
|
|
50
|
-
" \n" +
|
|
51
|
-
" int j;\n" +
|
|
52
|
-
"}";
|
|
53
|
-
// prettier-ignore
|
|
54
|
-
var expectedOutput = "{\n" +
|
|
55
|
-
" int i;\n" +
|
|
56
|
-
"\n" +
|
|
57
|
-
" int j;\n" +
|
|
58
|
-
"}";
|
|
59
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
60
|
-
snippet: snippet,
|
|
61
|
-
expectedOutput: expectedOutput,
|
|
62
|
-
entryPoint: "classBody"
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
it("should add exactly one blank lines before method declarations", function () {
|
|
66
|
-
var snippet = "{\n" +
|
|
67
|
-
" int i;\n" +
|
|
68
|
-
" void t() {}" +
|
|
69
|
-
"\n" +
|
|
70
|
-
" void u() {}" +
|
|
71
|
-
"\n" +
|
|
72
|
-
"\n" +
|
|
73
|
-
"void v() {}" +
|
|
74
|
-
"}";
|
|
75
|
-
var expectedOutput = "{\n" +
|
|
76
|
-
" int i;\n" +
|
|
77
|
-
"\n" +
|
|
78
|
-
" void t() {}\n" +
|
|
79
|
-
"\n" +
|
|
80
|
-
" void u() {}\n" +
|
|
81
|
-
"\n" +
|
|
82
|
-
" void v() {}\n" +
|
|
83
|
-
"}";
|
|
84
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
85
|
-
snippet: snippet,
|
|
86
|
-
expectedOutput: expectedOutput,
|
|
87
|
-
entryPoint: "classBody"
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe("Empty statements", function () {
|
|
91
|
-
it("should handle an class body with only empty statements", function () {
|
|
92
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
93
|
-
snippet: "{;;}",
|
|
94
|
-
expectedOutput: "{}",
|
|
95
|
-
entryPoint: "classBody"
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
it("should handle blank lines between field declarations", function () {
|
|
99
|
-
var snippet = "{\n" +
|
|
100
|
-
" int i;;int j;;\n" +
|
|
101
|
-
" int k;;\n" +
|
|
102
|
-
" ;\n" +
|
|
103
|
-
" int l;;\n" +
|
|
104
|
-
" \n" +
|
|
105
|
-
" int m;;\n" +
|
|
106
|
-
"}";
|
|
107
|
-
var expectedOutput = "{\n" +
|
|
108
|
-
" int i;\n" +
|
|
109
|
-
" int j;\n" +
|
|
110
|
-
" int k;\n" +
|
|
111
|
-
"\n" +
|
|
112
|
-
" int l;\n" +
|
|
113
|
-
"\n" +
|
|
114
|
-
" int m;\n" +
|
|
115
|
-
"}";
|
|
116
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
117
|
-
snippet: snippet,
|
|
118
|
-
expectedOutput: expectedOutput,
|
|
119
|
-
entryPoint: "classBody"
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
it("should handle blank lines before method declarations", function () {
|
|
123
|
-
var snippet = "{\n" +
|
|
124
|
-
" int i;;\n" +
|
|
125
|
-
" void t() {}" +
|
|
126
|
-
"\n" +
|
|
127
|
-
"\n;" +
|
|
128
|
-
" void u() {}" +
|
|
129
|
-
"\n;;" +
|
|
130
|
-
"\n" +
|
|
131
|
-
"void v() {}" +
|
|
132
|
-
"}";
|
|
133
|
-
var expectedOutput = "{\n" +
|
|
134
|
-
" int i;\n" +
|
|
135
|
-
"\n" +
|
|
136
|
-
" void t() {}\n" +
|
|
137
|
-
"\n" +
|
|
138
|
-
" void u() {}\n" +
|
|
139
|
-
"\n" +
|
|
140
|
-
" void v() {}\n" +
|
|
141
|
-
"}";
|
|
142
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
143
|
-
snippet: snippet,
|
|
144
|
-
expectedOutput: expectedOutput,
|
|
145
|
-
entryPoint: "classBody"
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
it("should print comments attached to empty statement where only empty statements", function () {
|
|
149
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
150
|
-
snippet: "{;/* TODO */;}",
|
|
151
|
-
expectedOutput: "{\n" + " /* TODO */\n" + "}",
|
|
152
|
-
entryPoint: "classBody"
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
it("should print comments attached to empty statement between field declarations", function () {
|
|
156
|
-
var snippet = "{\n" +
|
|
157
|
-
" int i;/* TODO */;int j;;\n" +
|
|
158
|
-
" int k;/* TODO */;\n" +
|
|
159
|
-
" \n" +
|
|
160
|
-
" /* TODO */;\n" +
|
|
161
|
-
" \n" +
|
|
162
|
-
" int l;;\n" +
|
|
163
|
-
"}";
|
|
164
|
-
var expectedOutput = "{\n" +
|
|
165
|
-
" int i;\n" +
|
|
166
|
-
" /* TODO */\n" +
|
|
167
|
-
" int j;\n" +
|
|
168
|
-
" int k;\n" +
|
|
169
|
-
"\n" +
|
|
170
|
-
" /* TODO */\n" +
|
|
171
|
-
" /* TODO */\n" +
|
|
172
|
-
" int l;\n" +
|
|
173
|
-
"}";
|
|
174
|
-
test_utils_1.expectSnippetToBeFormatted({
|
|
175
|
-
snippet: snippet,
|
|
176
|
-
expectedOutput: expectedOutput,
|
|
177
|
-
entryPoint: "classBody"
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|