diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 0b57a6a49..973b20497 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -594,6 +594,18 @@ ] } }, + "OverridingNotOverriding": { + "node": [ + "recurse", + "hardlineWithoutBreakParent" + ] + }, + "OverridingOverriding": { + "node": [ + "recurse", + "hardlineWithoutBreakParent" + ] + }, "PackageBody": { "node": [ { @@ -940,6 +952,156 @@ "field": "f_range" } }, + "SubpBody": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_overriding" + }, + { + "kind": "recurse_field", + "field": "f_subp_spec" + }, + { + "kind": "align", + "width": 2, + "contents": { + "kind": "recurse_field", + "field": "f_aspects" + } + }, + "hardlineWithoutBreakParent", + { + "kind": "text", + "text": "is" + }, + { + "kind": "recurse_field", + "field": "f_decls" + }, + { + "kind": "text", + "text": "begin" + }, + { + "kind": "indent", + "contents": [ + "hardlineWithoutBreakParent", + { + "kind": "recurse_field", + "field": "f_stmts" + } + ] + }, + "hardlineWithoutBreakParent", + { + "kind": "text", + "text": "end" + }, + { + "kind": "recurse_field", + "field": "f_end_name" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_decls": [ + { + "kind": "indent", + "contents": [ + "hardlineWithoutBreakParent", + "recurse" + ] + }, + "hardlineWithoutBreakParent" + ] + } + }, + "SubpDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_overriding" + }, + { + "kind": "recurse_field", + "field": "f_subp_spec" + }, + { + "kind": "align", + "width": 2, + "contents": { + "kind": "recurse_field", + "field": "f_aspects" + } + }, + { + "kind": "text", + "text": ";" + } + ] + } + }, + "SubpSpec": { + "node": { + "kind": "align", + "width": 2, + "contents": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_subp_kind" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_subp_name" + }, + "line", + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_subp_params" + }, + { + "kind": "recurse_field", + "field": "f_subp_returns" + } + ] + } + ] + } + }, + "fields": { + "f_subp_returns": { + "kind": "align", + "width": 1, + "contents": { + "kind": "group", + "document": [ + "line", + { + "kind": "text", + "text": "return" + }, + "whitespace", + "recurse" + ] + } + } + } + }, "UnconstrainedArrayIndices": { "node": { "kind": "align", diff --git a/testsuite/tests/unparsing/subp_body/no_end_name/doc-baseline.json b/testsuite/tests/unparsing/subp_body/no_end_name/doc-baseline.json new file mode 100644 index 000000000..8e3908add --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/no_end_name/doc-baseline.json @@ -0,0 +1,980 @@ +{ + "id": 122, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 121, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 106, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 105, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 107, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 108, + "kind": "text", + "text": "is" + }, + { + "id": 112, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 111, + "kind": "list", + "list": [ + { + "id": 109, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 110, + "kind": "text", + "text": "type Garply;" + } + ] + } + } + }, + { + "id": 113, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 114, + "kind": "text", + "text": "begin" + }, + { + "id": 118, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 117, + "kind": "list", + "list": [ + { + "id": 115, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 116, + "kind": "text", + "text": "null;" + } + ] + } + } + }, + { + "id": 119, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 120, + "kind": "text", + "text": "end;" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_body/no_end_name/input.ada b/testsuite/tests/unparsing/subp_body/no_end_name/input.ada new file mode 100644 index 000000000..1207888ea --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/no_end_name/input.ada @@ -0,0 +1 @@ +function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred is type Garply;begin null;end; diff --git a/testsuite/tests/unparsing/subp_body/no_end_name/test.out b/testsuite/tests/unparsing/subp_body/no_end_name/test.out new file mode 100644 index 000000000..6ad8998f8 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/no_end_name/test.out @@ -0,0 +1,6 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred +is + type Garply; +begin + null; +end; diff --git a/testsuite/tests/unparsing/subp_body/no_end_name/test.yaml b/testsuite/tests/unparsing/subp_body/no_end_name/test.yaml new file mode 100644 index 000000000..2ba07715c --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/no_end_name/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_body +description: | + Test a `SubpBody` without the end label. diff --git a/testsuite/tests/unparsing/subp_body/with_decls/doc-baseline.json b/testsuite/tests/unparsing/subp_body/with_decls/doc-baseline.json new file mode 100644 index 000000000..82d1d7d6b --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/with_decls/doc-baseline.json @@ -0,0 +1,980 @@ +{ + "id": 122, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 121, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 106, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 105, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 107, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 108, + "kind": "text", + "text": "is" + }, + { + "id": 112, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 111, + "kind": "list", + "list": [ + { + "id": 109, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 110, + "kind": "text", + "text": "type Garply;" + } + ] + } + } + }, + { + "id": 113, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 114, + "kind": "text", + "text": "begin" + }, + { + "id": 118, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 117, + "kind": "list", + "list": [ + { + "id": 115, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 116, + "kind": "text", + "text": "null;" + } + ] + } + } + }, + { + "id": 119, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 120, + "kind": "text", + "text": "end Foo;" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_body/with_decls/input.ada b/testsuite/tests/unparsing/subp_body/with_decls/input.ada new file mode 100644 index 000000000..150e7e96a --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/with_decls/input.ada @@ -0,0 +1 @@ +function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred is type Garply;begin null; end Foo; diff --git a/testsuite/tests/unparsing/subp_body/with_decls/test.out b/testsuite/tests/unparsing/subp_body/with_decls/test.out new file mode 100644 index 000000000..a44997e62 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/with_decls/test.out @@ -0,0 +1,6 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred +is + type Garply; +begin + null; +end Foo; diff --git a/testsuite/tests/unparsing/subp_body/with_decls/test.yaml b/testsuite/tests/unparsing/subp_body/with_decls/test.yaml new file mode 100644 index 000000000..bd3015746 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/with_decls/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_body +description: | + Test a `SubpBody` with a non empty declarative part. diff --git a/testsuite/tests/unparsing/subp_body/without_decls/doc-baseline.json b/testsuite/tests/unparsing/subp_body/without_decls/doc-baseline.json new file mode 100644 index 000000000..e69de29bb diff --git a/testsuite/tests/unparsing/subp_body/without_decls/input.ada b/testsuite/tests/unparsing/subp_body/without_decls/input.ada new file mode 100644 index 000000000..d6fe759b1 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/without_decls/input.ada @@ -0,0 +1 @@ +function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred is begin null; end Foo; diff --git a/testsuite/tests/unparsing/subp_body/without_decls/test.out b/testsuite/tests/unparsing/subp_body/without_decls/test.out new file mode 100644 index 000000000..b01a86866 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/without_decls/test.out @@ -0,0 +1,5 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred +is +begin + null; +end Foo; diff --git a/testsuite/tests/unparsing/subp_body/without_decls/test.yaml b/testsuite/tests/unparsing/subp_body/without_decls/test.yaml new file mode 100644 index 000000000..a14b8b3c0 --- /dev/null +++ b/testsuite/tests/unparsing/subp_body/without_decls/test.yaml @@ -0,0 +1,11 @@ +driver: unparser +rule: subp_body +description: | + Test that when `f_decls` is empty, there is not an empty line between `is` + and `begin`. +control: + - [ + XFAIL, + "True", + "https://gitlab.adacore-it.com/eng/libadalang/langkit/-/issues/760", + ] diff --git a/testsuite/tests/unparsing/subp_decl/long_not_overriding/doc-baseline.json b/testsuite/tests/unparsing/subp_decl/long_not_overriding/doc-baseline.json new file mode 100644 index 000000000..3d93b0815 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_not_overriding/doc-baseline.json @@ -0,0 +1,899 @@ +{ + "id": 111, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 110, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "not overriding" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 106, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 105, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 104, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "function Foo" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 94, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 92, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 91, + "kind": "list", + "list": [ + { + "id": 24, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 23, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "text", + "text": "AAAAA" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": " :" + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 21, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 18, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 25, + "kind": "text", + "text": ";" + }, + { + "id": 26, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 45, + "kind": "list", + "list": [ + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "text", + "text": "BBBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 29, + "kind": "text", + "text": " :" + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 30, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 43, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 40, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 39, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 38, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 47, + "kind": "text", + "text": ";" + }, + { + "id": 48, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 67, + "kind": "list", + "list": [ + { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 49, + "kind": "text", + "text": "CCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 51, + "kind": "text", + "text": " :" + }, + { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 52, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 53, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 65, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 62, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 61, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 60, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 69, + "kind": "text", + "text": ";" + }, + { + "id": 70, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 71, + "kind": "text", + "text": "DDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 73, + "kind": "text", + "text": " :" + }, + { + "id": 79, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 74, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 75, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 87, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 86, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 85, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 84, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 83, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 82, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 93, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 100, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 99, + "kind": "list", + "list": [ + { + "id": 97, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 98, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 107, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 109, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_decl/long_not_overriding/input.ada b/testsuite/tests/unparsing/subp_decl/long_not_overriding/input.ada new file mode 100644 index 000000000..151009d1c --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_not_overriding/input.ada @@ -0,0 +1 @@ +not overriding function Foo(AAAAA:Bar;BBBBB:Baz;CCCC:Qux;DDDD:Corge)return Fred; diff --git a/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.out b/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.out new file mode 100644 index 000000000..7d858b7ba --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.out @@ -0,0 +1,2 @@ +not overriding +function Foo (AAAAA : Bar; BBBBB : Baz; CCCC : Qux; DDDD : Corge) return Fred; diff --git a/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.yaml b/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.yaml new file mode 100644 index 000000000..e4d6cf2ef --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_not_overriding/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_decl +description: | + Test that when the declaration is too long, the first break happens after the + `f_overriding` field. diff --git a/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/doc-baseline.json b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/doc-baseline.json new file mode 100644 index 000000000..c82aa2491 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/doc-baseline.json @@ -0,0 +1,1006 @@ +{ + "id": 124, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 123, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Freddddddddddddd" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 121, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 120, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 119, + "kind": "list", + "list": [ + { + "id": 108, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 107, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 106, + "kind": "text", + "text": "with" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 118, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 113, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 114, + "kind": "text", + "text": "Garplyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 112, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 111, + "kind": "list", + "list": [ + { + "id": 109, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 110, + "kind": "text", + "text": "Garplyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 122, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/input.ada b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/input.ada new file mode 100644 index 000000000..05bb3eaff --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/input.ada @@ -0,0 +1,2 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Freddddddddddddd + with Garplyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy; diff --git a/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.out b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.out new file mode 100644 index 000000000..eb3ccb89f --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.out @@ -0,0 +1,3 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Freddddddddddddd + with + Garplyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy; diff --git a/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.yaml b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.yaml new file mode 100644 index 000000000..c42217293 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_long_aspects/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_decl +description: | + Test that when the spec and aspects are too long, the `with` keyword is in + its own line. diff --git a/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/doc-baseline.json b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/doc-baseline.json new file mode 100644 index 000000000..dcb31c4c5 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/doc-baseline.json @@ -0,0 +1,1006 @@ +{ + "id": 124, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 123, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Freddddddddddddd" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 121, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 120, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 119, + "kind": "list", + "list": [ + { + "id": 108, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 107, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 106, + "kind": "text", + "text": "with" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 118, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 113, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 114, + "kind": "text", + "text": "Garply" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 112, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 111, + "kind": "list", + "list": [ + { + "id": 109, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 110, + "kind": "text", + "text": "Garply" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 122, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/input.ada b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/input.ada new file mode 100644 index 000000000..42fe5eac9 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/input.ada @@ -0,0 +1 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Freddddddddddddd with Garply; diff --git a/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.out b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.out new file mode 100644 index 000000000..de530859c --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.out @@ -0,0 +1,2 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Freddddddddddddd + with Garply; diff --git a/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.yaml b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.yaml new file mode 100644 index 000000000..ad9a44543 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/long_with_short_aspects/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_decl +description: | + Test that when no line break is added after the `with` keyword when the + aspects fit on the same line. diff --git a/testsuite/tests/unparsing/subp_decl/short_overriding/doc-baseline.json b/testsuite/tests/unparsing/subp_decl/short_overriding/doc-baseline.json new file mode 100644 index 000000000..013c46064 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_overriding/doc-baseline.json @@ -0,0 +1,899 @@ +{ + "id": 111, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 110, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "overriding" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 106, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 105, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 104, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "function Foo" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 94, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 92, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 91, + "kind": "list", + "list": [ + { + "id": 24, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 23, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": " :" + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 21, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 18, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 25, + "kind": "text", + "text": ";" + }, + { + "id": 26, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 45, + "kind": "list", + "list": [ + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 29, + "kind": "text", + "text": " :" + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 30, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 43, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 40, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 39, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 38, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 47, + "kind": "text", + "text": ";" + }, + { + "id": 48, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 67, + "kind": "list", + "list": [ + { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 49, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 51, + "kind": "text", + "text": " :" + }, + { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 52, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 53, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 65, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 62, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 61, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 60, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 69, + "kind": "text", + "text": ";" + }, + { + "id": 70, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 71, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 73, + "kind": "text", + "text": " :" + }, + { + "id": 79, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 74, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 75, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 87, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 86, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 85, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 84, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 83, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 82, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 93, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 100, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 99, + "kind": "list", + "list": [ + { + "id": 97, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 98, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 107, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 109, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_decl/short_overriding/input.ada b/testsuite/tests/unparsing/subp_decl/short_overriding/input.ada new file mode 100644 index 000000000..ab9b533e7 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_overriding/input.ada @@ -0,0 +1 @@ +overriding function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred; diff --git a/testsuite/tests/unparsing/subp_decl/short_overriding/test.out b/testsuite/tests/unparsing/subp_decl/short_overriding/test.out new file mode 100644 index 000000000..b4600e68e --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_overriding/test.out @@ -0,0 +1,2 @@ +overriding +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred; diff --git a/testsuite/tests/unparsing/subp_decl/short_overriding/test.yaml b/testsuite/tests/unparsing/subp_decl/short_overriding/test.yaml new file mode 100644 index 000000000..9f2c02a97 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_overriding/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_decl +description: | + Test that no line break is added after the `f_overriding` fields when the + declaration fits in one line. diff --git a/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/doc-baseline.json b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/doc-baseline.json new file mode 100644 index 000000000..1dd01840b --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/doc-baseline.json @@ -0,0 +1,1006 @@ +{ + "id": 124, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 123, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 121, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 120, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 119, + "kind": "list", + "list": [ + { + "id": 108, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 107, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 106, + "kind": "text", + "text": "with" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 118, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 113, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 114, + "kind": "text", + "text": "Garplyyyyyyyyyyyyyyyyyy" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 112, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 111, + "kind": "list", + "list": [ + { + "id": 109, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 110, + "kind": "text", + "text": "Garplyyyyyyyyyyyyyyyyyy" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 122, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/input.ada b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/input.ada new file mode 100644 index 000000000..1a73577e1 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/input.ada @@ -0,0 +1 @@ +function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred with Garplyyyyyyyyyyyyyyyyyy; diff --git a/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.out b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.out new file mode 100644 index 000000000..8eb346783 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.out @@ -0,0 +1,2 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred with + Garplyyyyyyyyyyyyyyyyyy; diff --git a/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.yaml b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.yaml new file mode 100644 index 000000000..8c026e2f9 --- /dev/null +++ b/testsuite/tests/unparsing/subp_decl/short_with_long_aspects/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_decl +description: | + Test that no line break is added after the spec when the `with` still fits + in the same line. diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_long/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/everything_long/doc-baseline.json new file mode 100644 index 000000000..07a9f238b --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_long/doc-baseline.json @@ -0,0 +1,846 @@ +{ + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "AAAAAAAAAAAA" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "BBBBBBBBBBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "CCCCCCCCCCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "DDDDDDDDDDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_long/input.ada b/testsuite/tests/unparsing/subp_spec/function/everything_long/input.ada new file mode 100644 index 000000000..eaf93d6f9 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_long/input.ada @@ -0,0 +1,5 @@ +function Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBB : Baz; + CCCCCCCCCCCC : Qux; + DDDDDDDDDDDD : Corge) return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_long/test.out b/testsuite/tests/unparsing/subp_spec/function/everything_long/test.out new file mode 100644 index 000000000..f266286a0 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_long/test.out @@ -0,0 +1,6 @@ +function Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBB : Baz; + CCCCCCCCCCCC : Qux; + DDDDDDDDDDDD : Corge) + return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_long/test.yaml b/testsuite/tests/unparsing/subp_spec/function/everything_long/test.yaml new file mode 100644 index 000000000..36530782a --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_long/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: subp_spec +description: | + Test line breaks after the funtion name, between parameters and before the + return. diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_short/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/everything_short/doc-baseline.json new file mode 100644 index 000000000..2364bd0b8 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_short/doc-baseline.json @@ -0,0 +1,846 @@ +{ + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_short/input.ada b/testsuite/tests/unparsing/subp_spec/function/everything_short/input.ada new file mode 100644 index 000000000..a9d8bbfbb --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_short/input.ada @@ -0,0 +1 @@ +function Foo(A:Bar;B:Baz;C:Qux;D:Corge)return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_short/test.out b/testsuite/tests/unparsing/subp_spec/function/everything_short/test.out new file mode 100644 index 000000000..01e3e00a6 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_short/test.out @@ -0,0 +1 @@ +function Foo (A : Bar; B : Baz; C : Qux; D : Corge) return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/everything_short/test.yaml b/testsuite/tests/unparsing/subp_spec/function/everything_short/test.yaml new file mode 100644 index 000000000..d56a1d700 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/everything_short/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test that no line breaks are added when the spec fits on one line. diff --git a/testsuite/tests/unparsing/subp_spec/function/long_name/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/long_name/doc-baseline.json new file mode 100644 index 000000000..ed4a3f2b1 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_name/doc-baseline.json @@ -0,0 +1,846 @@ +{ + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Fooooooo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "AAAA" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "BBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "CCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "DDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/long_name/input.ada b/testsuite/tests/unparsing/subp_spec/function/long_name/input.ada new file mode 100644 index 000000000..b19ea857a --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_name/input.ada @@ -0,0 +1 @@ +function Fooooooo (AAAA : Bar; BBBB : Baz; CCCC : Qux; DDDD : Corge) return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/long_name/test.out b/testsuite/tests/unparsing/subp_spec/function/long_name/test.out new file mode 100644 index 000000000..b42826d47 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_name/test.out @@ -0,0 +1,2 @@ +function Fooooooo + (AAAA : Bar; BBBB : Baz; CCCC : Qux; DDDD : Corge) return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/long_name/test.yaml b/testsuite/tests/unparsing/subp_spec/function/long_name/test.yaml new file mode 100644 index 000000000..4edeb4bed --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_name/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test line break after the funtion name. diff --git a/testsuite/tests/unparsing/subp_spec/function/long_no_params/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/long_no_params/doc-baseline.json new file mode 100644 index 000000000..33b528e28 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_no_params/doc-baseline.json @@ -0,0 +1,100 @@ +{ + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 3, + "kind": "text", + "text": "return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/long_no_params/input.ada b/testsuite/tests/unparsing/subp_spec/function/long_no_params/input.ada new file mode 100644 index 000000000..857142ba1 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_no_params/input.ada @@ -0,0 +1 @@ +function Foo return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.out b/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.out new file mode 100644 index 000000000..b732fb549 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.out @@ -0,0 +1,2 @@ +function Foo + return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.yaml b/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.yaml new file mode 100644 index 000000000..f1e830624 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_no_params/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test line break after the funtion name when there are no params. diff --git a/testsuite/tests/unparsing/subp_spec/function/long_params/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/long_params/doc-baseline.json new file mode 100644 index 000000000..1a7ea4b3f --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_params/doc-baseline.json @@ -0,0 +1,846 @@ +{ + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "AAAAAAAAAAAA" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "BBBBBBBBBBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "CCCCCCCCCCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "DDDDDDDDDDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Fred" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/long_params/input.ada b/testsuite/tests/unparsing/subp_spec/function/long_params/input.ada new file mode 100644 index 000000000..09c84a453 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_params/input.ada @@ -0,0 +1,2 @@ +function Foo + (AAAAAAAAAAAA : Bar; BBBBBBBBBBBB : Baz; CCCCCCCCCCCC : Qux; DDDDDDDDDDDD : Corge) return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/long_params/test.out b/testsuite/tests/unparsing/subp_spec/function/long_params/test.out new file mode 100644 index 000000000..9c314b6f8 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_params/test.out @@ -0,0 +1,5 @@ +function Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBB : Baz; + CCCCCCCCCCCC : Qux; + DDDDDDDDDDDD : Corge) return Fred diff --git a/testsuite/tests/unparsing/subp_spec/function/long_params/test.yaml b/testsuite/tests/unparsing/subp_spec/function/long_params/test.yaml new file mode 100644 index 000000000..922543703 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_params/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test line breaks between the funtion parameters. diff --git a/testsuite/tests/unparsing/subp_spec/function/long_return/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/function/long_return/doc-baseline.json new file mode 100644 index 000000000..6229fb21b --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_return/doc-baseline.json @@ -0,0 +1,846 @@ +{ + "id": 104, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "AAAA" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "BBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "CCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "DDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 95, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "text", + "text": "return Freeeeeed" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/function/long_return/input.ada b/testsuite/tests/unparsing/subp_spec/function/long_return/input.ada new file mode 100644 index 000000000..fb4ca0801 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_return/input.ada @@ -0,0 +1 @@ +function Foo (AAAA : Bar; BBBB : Baz; CCCC : Qux; DDDD : Corge) return Freeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/long_return/test.out b/testsuite/tests/unparsing/subp_spec/function/long_return/test.out new file mode 100644 index 000000000..bfc9b7c7d --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_return/test.out @@ -0,0 +1,2 @@ +function Foo + (AAAA : Bar; BBBB : Baz; CCCC : Qux; DDDD : Corge) return Freeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/long_return/test.yaml b/testsuite/tests/unparsing/subp_spec/function/long_return/test.yaml new file mode 100644 index 000000000..cc0413c60 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/long_return/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test the line break before the function return. diff --git a/testsuite/tests/unparsing/subp_spec/procedure/everything_short/doc-baseline.json b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/doc-baseline.json new file mode 100644 index 000000000..21310db25 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/doc-baseline.json @@ -0,0 +1,804 @@ +{ + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "Bar" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } +} diff --git a/testsuite/tests/unparsing/subp_spec/procedure/everything_short/input.ada b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/input.ada new file mode 100644 index 000000000..49da03c3f --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/input.ada @@ -0,0 +1 @@ +procedure Foo(A:Bar;B:Baz;C:Qux;D:Corge) diff --git a/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.out b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.out new file mode 100644 index 000000000..15d28fa1f --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.out @@ -0,0 +1 @@ +procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) diff --git a/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.yaml b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.yaml new file mode 100644 index 000000000..fd76a6598 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/procedure/everything_short/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Base test for a procedure. All other variations are tests with functions.