From ba6a5e909debeafefbe5428a18a82074450fe33d Mon Sep 17 00:00:00 2001 From: Joao Azevedo Date: Fri, 26 Jul 2024 08:01:38 +0000 Subject: [PATCH] Add table alignment to AggregateAssoc, ComponentDecl, ObjectDecl, ParamAssoc and ParamSpec --- extensions/default_unparsing_config.json | 624 ++++++++++-------- .../aggregate/long_complete/test.out | 2 +- .../bracket_aggregate/long_complete/test.out | 2 +- .../unparsing/call_stmt/long_params/input.ada | 1 + .../unparsing/call_stmt/long_params/test.out | 2 + .../unparsing/call_stmt/long_params/test.yaml | 5 + .../unparsing/call_stmt/param_align/test.out | 6 +- .../enum_rep_clause/everything_long/test.out | 10 +- .../enum_rep_clause/long_aggregate/test.out | 10 +- .../long_with_params/test.out | 6 +- .../empty_formal_part/test.out | 4 +- .../non_empty_formal_part/test.out | 6 +- .../long_with_params/test.out | 6 +- .../unparsing/object_decl/table/input.ada | 9 + .../unparsing/object_decl/table/test.out | 11 + .../unparsing/object_decl/table/test.yaml | 6 + .../test.out | 4 +- .../record_type_def/simple_record/test.out | 4 +- .../function/param_ids_diff_length/input.ada | 5 + .../function/param_ids_diff_length/test.out | 6 + .../function/param_ids_diff_length/test.yaml | 4 + .../param_ids_types_diff_length/input.ada | 5 + .../param_ids_types_diff_length/test.out | 8 + .../param_ids_types_diff_length/test.yaml | 6 + 24 files changed, 434 insertions(+), 318 deletions(-) create mode 100644 testsuite/tests/unparsing/call_stmt/long_params/input.ada create mode 100644 testsuite/tests/unparsing/call_stmt/long_params/test.out create mode 100644 testsuite/tests/unparsing/call_stmt/long_params/test.yaml create mode 100644 testsuite/tests/unparsing/object_decl/table/input.ada create mode 100644 testsuite/tests/unparsing/object_decl/table/test.out create mode 100644 testsuite/tests/unparsing/object_decl/table/test.yaml create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/input.ada create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.out create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.yaml create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/input.ada create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.out create mode 100644 testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.yaml diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 253f547a1..82d960445 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -28,6 +28,13 @@ } } }, + "AbstractStateDeclList": { + "sep": [ + "recurse", + "line" + ], + "table": null + }, "AbstractSubpDecl": { "node": { "kind": "group", @@ -173,10 +180,12 @@ } }, "AdaNodeList": { - "sep": [ - "recurse", - "hardline" - ] + "table": { + "split": [ + "empty_line" + ], + "must_break": true + } }, "Aggregate": { "node": { @@ -224,35 +233,33 @@ } }, "AggregateAssoc": { - "node": { - "kind": "group", - "document": [ + "node": [ + { + "kind": "recurse_field", + "field": "f_designators" + }, + { + "kind": "recurse_field", + "field": "f_r_expr" + } + ], + "fields": { + "f_designators": [ + "recurse", + "whitespace", { - "kind": "recurse_field", - "field": "f_designators" + "kind": "tableSeparator", + "text": "=>" }, { - "kind": "innerRoot", - "contents": { - "kind": "recurse_field", - "field": "f_r_expr" + "kind": "ifBreak", + "flatContents": "whitespace", + "breakContents": { + "kind": "continuationLineIndent", + "contents": "line" } } ] - }, - "fields": { - "f_designators": { - "kind": "continuationLineIndent", - "contents": [ - "recurse", - "whitespace", - { - "kind": "text", - "text": "=>" - }, - "line" - ] - } } }, "Allocator": { @@ -294,7 +301,8 @@ "line", "recurse", "whitespace" - ] + ], + "table": null }, "AnonymousTypeDecl": { "node": { @@ -454,6 +462,11 @@ } } }, + "AssocList": { + "table": { + "must_break": false + } + }, "AttributeDefClause": { "node": { "kind": "group", @@ -510,18 +523,17 @@ ] } }, - "AssocList": { - "sep": [ - "recurse", - "line" - ] - }, "BaseAssocList": { "sep": [ "recurse", "line" ] }, + "BasicAssocList": { + "table": { + "must_break": false + } + }, "BinOp": { "node": { "kind": "group", @@ -642,37 +654,37 @@ "CallExpr": { "node": { "kind": "innerRoot", - "contents": [ - { - "kind": "continuationLineIndent", - "contents": { - "kind": "group", - "document": [ - { - "kind": "recurse_field", - "field": "f_name" - }, - "line", - { - "kind": "text", - "text": "(" - }, - { - "kind": "align", - "width": " ", - "contents": { + "contents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_name" + }, + "line", + { + "kind": "text", + "text": "(" + }, + { + "kind": "innerRoot", + "contents": { + "kind": "group", + "document": { "kind": "recurse_field", "field": "f_suffix" } - }, - { - "kind": "text", - "text": ")" } - ] - } + }, + { + "kind": "text", + "text": ")" + } + ] } - ] + } } }, "CallStmt": { @@ -973,63 +985,82 @@ } }, "ComponentDecl": { - "node": { - "kind": "group", - "document": [ - { - "kind": "group", - "document": [ - { - "kind": "group", - "document": { + "node": [ + { + "kind": "group", + "document": { + "kind": "recurse_field", + "field": "f_ids" + } + }, + "whitespace", + { + "kind": "tableSeparator", + "text": ":" + }, + { + "kind": "group", + "document": [ + "line", + { + "kind": "continuationLineIndent", + "contents": [ + { "kind": "recurse_field", - "field": "f_ids" + "field": "f_component_def" } - }, - "whitespace", - { - "kind": "text", - "text": ":" - }, - "line", - { - "kind": "continuationLineIndent", - "contents": [ - { - "kind": "recurse_field", - "field": "f_component_def" - }, - { - "kind": "recurse_field", - "field": "f_default_expr" - }, - { - "kind": "recurse_field", - "field": "f_aspects" - }, - { - "kind": "text", - "text": ";" - } - ] - } - ] - } - ] - }, + ] + } + ], + "id": "type" + }, + { + "kind": "recurse_field", + "field": "f_default_expr" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + { + "kind": "text", + "text": ";" + } + ], "fields": { "f_default_expr": [ "whitespace", { - "kind": "text", + "kind": "tableSeparator", "text": ":=" }, - "line", - "recurse" - ], - "f_aspects": [ - "line", - "recurse" + { + "kind": "ifBreak", + "breakContents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "line", + "recurse" + ] + } + } + }, + "flatContents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "line", + "recurse" + ] + } + }, + "groupId": "type" + } ] } }, @@ -1355,7 +1386,8 @@ "sep": [ "recurse", "line" - ] + ], + "table": null }, "DecimalFixedPointDef": { "node": { @@ -1455,6 +1487,13 @@ ] } }, + "DeclList": { + "sep": [ + "recurse", + "hardline" + ], + "table": null + }, "DefiningNameList": { "sep": [ "recurse", @@ -2382,7 +2421,8 @@ }, "line", "recurse" - ] + ], + "f_renaming_clause": "recurse" } }, "ExtendedReturnStmt": { @@ -3617,6 +3657,10 @@ ] ] } + }, + "fields": { + "f_default_expr": "recurse", + "f_renaming_clause": "recurse" } }, "NumberDecl": { @@ -3724,116 +3768,122 @@ } }, "ObjectDecl": { - "node": { - "kind": "group", - "document": [ - { - "kind": "group", - "document": [ - { - "kind": "group", - "document": { - "kind": "recurse_field", - "field": "f_ids" - } - }, - "whitespace", - { - "kind": "text", - "text": ":" - }, - { - "kind": "continuationLineIndent", - "contents": [ - "line", - { - "kind": "group", - "document": [ - { - "kind": "recurse_field", - "field": "f_has_aliased" - }, - { - "kind": "recurse_field", - "field": "f_has_constant" - }, - { - "kind": "recurse_field", - "field": "f_mode" - }, - { - "kind": "recurse_field", - "field": "f_type_expr" - } - ] - } - ] - } - ], - "id": "name_and_type" - }, - { - "kind": "ifBreak", - "breakContents": { + "node": [ + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_ids" + }, + "whitespace" + ] + }, + { + "kind": "tableSeparator", + "text": ":" + }, + { + "kind": "group", + "document": [ + { "kind": "continuationLineIndent", - "contents": { - "kind": "continuationLineIndent", - "contents": { + "contents": [ + "line", + { "kind": "group", "document": [ { "kind": "recurse_field", - "field": "f_default_expr" + "field": "f_has_aliased" }, { "kind": "recurse_field", - "field": "f_renaming_clause" + "field": "f_has_constant" }, { "kind": "recurse_field", - "field": "f_aspects" + "field": "f_mode" + }, + { + "kind": "recurse_field", + "field": "f_type_expr" } ] } + ] + } + ], + "id": "type" + }, + { + "kind": "recurse_field", + "field": "f_default_expr" + }, + { + "kind": "recurse_field", + "field": "f_renaming_clause" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + { + "kind": "text", + "text": ";" + } + ], + "fields": { + "f_renaming_clause": [ + { + "kind": "ifBreak", + "breakContents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "continuationLineIndent", + "contents": "recurse" } }, "flatContents": { "kind": "continuationLineIndent", - "contents": { - "kind": "group", - "document": [ - { - "kind": "recurse_field", - "field": "f_default_expr" - }, - { - "kind": "recurse_field", - "field": "f_renaming_clause" - }, - { - "kind": "recurse_field", - "field": "f_aspects" - } - ] - } + "contents": "recurse" }, - "groupId": "name_and_type" - }, - { - "kind": "text", - "text": ";" + "groupId": "type" } - ] - }, - "fields": { + ], "f_default_expr": [ "whitespace", { - "kind": "text", + "kind": "tableSeparator", "text": ":=" }, - "line", - "recurse" + { + "kind": "ifBreak", + "breakContents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "line", + "recurse" + ] + } + } + }, + "flatContents": { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "line", + "recurse" + ] + } + }, + "groupId": "type" + } ] } }, @@ -4091,31 +4141,35 @@ } }, "ParamAssoc": { - "node": { - "kind": "group", - "document": { - "kind": "continuationLineIndent", - "contents": [ - { - "kind": "recurse_field", - "field": "f_designator" - }, - { - "kind": "recurse_field", - "field": "f_r_expr" - } - ] + "node": [ + { + "kind": "recurse_field", + "field": "f_designator" + }, + { + "kind": "group", + "document": { + "kind": "recurse_field", + "field": "f_r_expr" + } } - }, + ], "fields": { "f_designator": [ "recurse", "whitespace", { - "kind": "text", + "kind": "tableSeparator", "text": "=>" }, - "line" + { + "kind": "ifBreak", + "flatContents": "whitespace", + "breakContents": { + "kind": "continuationLineIndent", + "contents": "line" + } + } ] } }, @@ -4146,49 +4200,65 @@ } }, "ParamSpec": { - "node": { - "kind": "group", - "document": [ - { - "kind": "group", - "document": [ - { - "kind": "group", - "document": { - "kind": "recurse_field", - "field": "f_ids" + "node": [ + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_ids" + }, + "whitespace" + ] + }, + { + "kind": "tableSeparator", + "text": ":" + }, + { + "kind": "group", + "document": [ + { + "kind": "continuationLineIndent", + "contents": [ + "line", + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_has_aliased" + }, + { + "kind": "recurse_field", + "field": "f_mode" + }, + { + "kind": "recurse_field", + "field": "f_type_expr" + } + ] } - }, - "whitespace", - { - "kind": "text", - "text": ":" - }, - { - "kind": "continuationLineIndent", - "contents": [ - "line", - { - "kind": "group", - "document": [ - { - "kind": "recurse_field", - "field": "f_has_aliased" - }, - { - "kind": "recurse_field", - "field": "f_mode" - }, - { - "kind": "recurse_field", - "field": "f_type_expr" - } - ] - } - ] - } - ], - "id": "name_and_type" + ] + } + ], + "id": "param_spec_type" + }, + { + "kind": "recurse_field", + "field": "f_default_expr" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ], + "fields": { + "f_default_expr": [ + "whitespace", + { + "kind": "tableSeparator", + "text": ":=" }, { "kind": "ifBreak", @@ -4199,14 +4269,8 @@ "contents": { "kind": "group", "document": [ - { - "kind": "recurse_field", - "field": "f_default_expr" - }, - { - "kind": "recurse_field", - "field": "f_aspects" - } + "line", + "recurse" ] } } @@ -4216,38 +4280,21 @@ "contents": { "kind": "group", "document": [ - { - "kind": "recurse_field", - "field": "f_default_expr" - }, - { - "kind": "recurse_field", - "field": "f_aspects" - } + "line", + "recurse" ] } }, - "groupId": "name_and_type" + "groupId": "param_spec_type" } ] - }, - "fields": { - "f_default_expr": [ - "whitespace", - { - "kind": "text", - "text": ":=" - }, - "line", - "recurse" - ] } }, "ParamSpecList": { - "sep": [ - "recurse", - "line" - ] + "table": { + "mustBreak": false + }, + "sep": "recurse" }, "ParenExpr": { "node": { @@ -5015,7 +5062,8 @@ "sep": [ "recurse", "hardline" - ] + ], + "table": null }, "SubpBody": { "node": { diff --git a/testsuite/tests/unparsing/aggregate/long_complete/test.out b/testsuite/tests/unparsing/aggregate/long_complete/test.out index 2eab88116..cd0a96512 100644 --- a/testsuite/tests/unparsing/aggregate/long_complete/test.out +++ b/testsuite/tests/unparsing/aggregate/long_complete/test.out @@ -1,4 +1,4 @@ Foo := (Baaaar with - Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, Baaaz => Bazzzzzzzz); diff --git a/testsuite/tests/unparsing/bracket_aggregate/long_complete/test.out b/testsuite/tests/unparsing/bracket_aggregate/long_complete/test.out index b429cbdfd..54ea65eb6 100644 --- a/testsuite/tests/unparsing/bracket_aggregate/long_complete/test.out +++ b/testsuite/tests/unparsing/bracket_aggregate/long_complete/test.out @@ -1,4 +1,4 @@ Foo := [Baaaar with - Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, Baaaz => Bazzzzzzzz]; diff --git a/testsuite/tests/unparsing/call_stmt/long_params/input.ada b/testsuite/tests/unparsing/call_stmt/long_params/input.ada new file mode 100644 index 000000000..e2f882920 --- /dev/null +++ b/testsuite/tests/unparsing/call_stmt/long_params/input.ada @@ -0,0 +1 @@ +Ada.Text_IO.Put_Line (Foooooooooooo, Prettier_Ada.Documents.Json.Serialize (Document)); diff --git a/testsuite/tests/unparsing/call_stmt/long_params/test.out b/testsuite/tests/unparsing/call_stmt/long_params/test.out new file mode 100644 index 000000000..ac3cad91e --- /dev/null +++ b/testsuite/tests/unparsing/call_stmt/long_params/test.out @@ -0,0 +1,2 @@ +Ada.Text_IO.Put_Line + (Foooooooooooo, Prettier_Ada.Documents.Json.Serialize (Document)); diff --git a/testsuite/tests/unparsing/call_stmt/long_params/test.yaml b/testsuite/tests/unparsing/call_stmt/long_params/test.yaml new file mode 100644 index 000000000..89ab6b2f1 --- /dev/null +++ b/testsuite/tests/unparsing/call_stmt/long_params/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: stmt +description: | + Tests that if the statement is too long, the underlying `CallExpr` breaks. + Additionally, this that if the `f_suffix` fits, it does not break. diff --git a/testsuite/tests/unparsing/call_stmt/param_align/test.out b/testsuite/tests/unparsing/call_stmt/param_align/test.out index 02a4249bd..8da7ec9a0 100644 --- a/testsuite/tests/unparsing/call_stmt/param_align/test.out +++ b/testsuite/tests/unparsing/call_stmt/param_align/test.out @@ -1,5 +1,5 @@ Foo - (AAAA => Foo_1, - BB => Foo_2, - CCCCCCC => Foo_3, + (AAAA => Foo_1, + BB => Foo_2, + CCCCCCC => Foo_3, DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD => 7); diff --git a/testsuite/tests/unparsing/enum_rep_clause/everything_long/test.out b/testsuite/tests/unparsing/enum_rep_clause/everything_long/test.out index 4895fe70c..5a33a0864 100644 --- a/testsuite/tests/unparsing/enum_rep_clause/everything_long/test.out +++ b/testsuite/tests/unparsing/enum_rep_clause/everything_long/test.out @@ -1,7 +1,7 @@ for VeeeeeeeeeeeeryLoooooooooooongTyyyyyyyyyyyyyyyyypeNaaaaaaaaaaaame use (Aaaaaaaaaaaa => 1, - Bbbbbbbbbbb => 5, - Ccccccccc => 10, - Dddd => 1, - E => 5, - F => 10); + Bbbbbbbbbbb => 5, + Ccccccccc => 10, + Dddd => 1, + E => 5, + F => 10); diff --git a/testsuite/tests/unparsing/enum_rep_clause/long_aggregate/test.out b/testsuite/tests/unparsing/enum_rep_clause/long_aggregate/test.out index e971921f8..47f2d2215 100644 --- a/testsuite/tests/unparsing/enum_rep_clause/long_aggregate/test.out +++ b/testsuite/tests/unparsing/enum_rep_clause/long_aggregate/test.out @@ -1,7 +1,7 @@ for T use (Aaaaaaaaaaaa => 1, - Bbbbbbbbbbb => 5, - Ccccccccc => 10, - Dddd => 1, - E => 5, - F => 10); + Bbbbbbbbbbb => 5, + Ccccccccc => 10, + Dddd => 1, + E => 5, + F => 10); diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out index ddcdeb5d8..7738860d3 100644 --- a/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out +++ b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out @@ -4,7 +4,7 @@ package Foo is new "-j", "--jobs", Garply => Natural, - Corge => 1, - Fred => + Corge => 1, + Fred => "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", - Bar => Bar_Foo); + Bar => Bar_Foo); diff --git a/testsuite/tests/unparsing/generic_subp_decl/empty_formal_part/test.out b/testsuite/tests/unparsing/generic_subp_decl/empty_formal_part/test.out index 1167d6c29..1a1fdad4a 100644 --- a/testsuite/tests/unparsing/generic_subp_decl/empty_formal_part/test.out +++ b/testsuite/tests/unparsing/generic_subp_decl/empty_formal_part/test.out @@ -1,5 +1,5 @@ generic function Perform_Comparison_Check (Comparing_Value : Foo_Bar_Baz; - Rule_Value : Foo_Bar_Baz; - Logic_Operator : Unbounded_String) return Boolean; + Rule_Value : Foo_Bar_Baz; + Logic_Operator : Unbounded_String) return Boolean; diff --git a/testsuite/tests/unparsing/generic_subp_decl/non_empty_formal_part/test.out b/testsuite/tests/unparsing/generic_subp_decl/non_empty_formal_part/test.out index 4dfbcad18..c1506717b 100644 --- a/testsuite/tests/unparsing/generic_subp_decl/non_empty_formal_part/test.out +++ b/testsuite/tests/unparsing/generic_subp_decl/non_empty_formal_part/test.out @@ -2,9 +2,9 @@ generic type Foo_Bar_Baz is private; with function ">" - (Left_Left_Left_Left_Left : Foo_Bar_Baz; + (Left_Left_Left_Left_Left : Foo_Bar_Baz; Right_Right_Right_Right_Right : Foo_Bar_Baz) return Boolean is <>; function Perform_Comparison_Check (Comparing_Value : Foo_Bar_Baz; - Rule_Value : Foo_Bar_Baz; - Logic_Operator : Unbounded_String) return Boolean; + Rule_Value : Foo_Bar_Baz; + Logic_Operator : Unbounded_String) return Boolean; diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out index 8fadcba84..90adbd51e 100644 --- a/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out @@ -4,7 +4,7 @@ function Foo is new "-j", "--jobs", Garply => Natural, - Corge => 1, - Fred => + Corge => 1, + Fred => "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", - Bar => Bar_Foo); + Bar => Bar_Foo); diff --git a/testsuite/tests/unparsing/object_decl/table/input.ada b/testsuite/tests/unparsing/object_decl/table/input.ada new file mode 100644 index 000000000..18171c8e9 --- /dev/null +++ b/testsuite/tests/unparsing/object_decl/table/input.ada @@ -0,0 +1,9 @@ +procedure Main is + AAAAAAAAAAAAAAAA : Baaaaaar := Bar; + BBBBBBBBBBBBBBBBBBBB : Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz := + Bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + CCCCCCCCCCCCCCCCCCCCCCCCCCCC : Quuuuuuuuuuuuuuuuuux := Qux; + DDDDDDDDDDDDDDD : Corge; +begin + null; +end Main; diff --git a/testsuite/tests/unparsing/object_decl/table/test.out b/testsuite/tests/unparsing/object_decl/table/test.out new file mode 100644 index 000000000..2e23be57f --- /dev/null +++ b/testsuite/tests/unparsing/object_decl/table/test.out @@ -0,0 +1,11 @@ +procedure Main +is + AAAAAAAAAAAAAAAA : Baaaaaar := Bar; + BBBBBBBBBBBBBBBBBBBB : + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz := + Bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + CCCCCCCCCCCCCCCCCCCCCCCCCCCC : Quuuuuuuuuuuuuuuuuux := Qux; + DDDDDDDDDDDDDDD : Corge; +begin + null; +end Main; diff --git a/testsuite/tests/unparsing/object_decl/table/test.yaml b/testsuite/tests/unparsing/object_decl/table/test.yaml new file mode 100644 index 000000000..03dda878a --- /dev/null +++ b/testsuite/tests/unparsing/object_decl/table/test.yaml @@ -0,0 +1,6 @@ +driver: unparser +rule: subp_body +description: | + Test the alignemnt of the `:` and `:=` tokens on `ObjectDecl` nodes. + Also test continuation line indentation when they're followed by a line + break. diff --git a/testsuite/tests/unparsing/record_type_def/record_with_component_default_expr/test.out b/testsuite/tests/unparsing/record_type_def/record_with_component_default_expr/test.out index 46260cf8f..75e96b81b 100644 --- a/testsuite/tests/unparsing/record_type_def/record_with_component_default_expr/test.out +++ b/testsuite/tests/unparsing/record_type_def/record_with_component_default_expr/test.out @@ -1,6 +1,6 @@ type Date is record A : Integer range 1 .. 31 := 15; - B : Real := 0.15; - C : String := "my_str"; + B : Real := 0.15; + C : String := "my_str"; end record; diff --git a/testsuite/tests/unparsing/record_type_def/simple_record/test.out b/testsuite/tests/unparsing/record_type_def/simple_record/test.out index 5fa42fc75..82744165c 100644 --- a/testsuite/tests/unparsing/record_type_def/simple_record/test.out +++ b/testsuite/tests/unparsing/record_type_def/simple_record/test.out @@ -1,6 +1,6 @@ type Date is record - Day : Integer range 1 .. 31; + Day : Integer range 1 .. 31; Month : Month_Enum; - Year : Integer range 0 .. 4000; + Year : Integer range 0 .. 4000; end record; diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/input.ada b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/input.ada new file mode 100644 index 000000000..0e4159ccc --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/input.ada @@ -0,0 +1,5 @@ +function Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBBB : Baz; + CCCCCCCCCCCCCC : Qux; + DDDDDDDDDDDDDDD : Corge) return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.out b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.out new file mode 100644 index 000000000..489ec00a9 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.out @@ -0,0 +1,6 @@ +function Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBBB : Baz; + CCCCCCCCCCCCCC : Qux; + DDDDDDDDDDDDDDD : Corge) + return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.yaml b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.yaml new file mode 100644 index 000000000..023f508c4 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_diff_length/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_spec +description: | + Test that parameters ids of different length are aligned by the `:` token. diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/input.ada b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/input.ada new file mode 100644 index 000000000..9cdad2b88 --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/input.ada @@ -0,0 +1,5 @@ +function Foo + (AAAAAAAAAAAAAAAA : Baaaaaar := Bar; + BBBBBBBBBBBBBBBBBBBB : Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz := Bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + CCCCCCCCCCCCCCCCCCCCCCCCCCCC : Quuuuuuuuuuuuuuuuuux := Qux; + DDDDDDDDDDDDDDD : Corge) return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.out b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.out new file mode 100644 index 000000000..33f73aa9b --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.out @@ -0,0 +1,8 @@ +function Foo + (AAAAAAAAAAAAAAAA : Baaaaaar := Bar; + BBBBBBBBBBBBBBBBBBBB : + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz := + Bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz; + CCCCCCCCCCCCCCCCCCCCCCCCCCCC : Quuuuuuuuuuuuuuuuuux := Qux; + DDDDDDDDDDDDDDD : Corge) + return Freeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed diff --git a/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.yaml b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.yaml new file mode 100644 index 000000000..2a170d9ef --- /dev/null +++ b/testsuite/tests/unparsing/subp_spec/function/param_ids_types_diff_length/test.yaml @@ -0,0 +1,6 @@ +driver: unparser +rule: subp_spec +description: | + Test the alignemnt of the `:` and `:=` tokens on `ParamSpec` nodes. + Also test continuation line indentation when they're followed by a line + break.