Skip to content

Commit

Permalink
Merge branch 'mku/fix_gnatformat_config_issues' into 'master'
Browse files Browse the repository at this point in the history
Fix gnatformat testing issues related to the default configuration file

See merge request eng/libadalang/libadalang!1695
  • Loading branch information
CKMonika committed Jul 15, 2024
2 parents f836232 + 6961814 commit 065dba8
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 6 deletions.
122 changes: 117 additions & 5 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,44 @@
}
}
},
"AbstractSubpDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_overriding"
},
{
"kind": "recurse_field",
"field": "f_subp_spec"
},
"line",
{
"kind": "text",
"text": "is"
},
{
"kind": "text",
"text": "abstract"
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_aspects": [
"hardlineWithoutBreakParent",
"recurse"
]
}
},
"AcceptStmt": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -228,7 +266,6 @@
"kind": "text",
"text": "new"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_subpool"
Expand All @@ -239,6 +276,20 @@
"field": "f_type_or_expr"
}
]
},
"fields": {
"f_subpool": [
"whitespace",
{
"kind": "text",
"text": "("
},
"recurse",
{
"kind": "text",
"text": ")"
}
]
}
},
"AlternativesList": {
Expand Down Expand Up @@ -617,8 +668,11 @@
"text": "("
},
{
"kind": "recurse_field",
"field": "f_suffix"
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_suffix"
}
},
{
"kind": "text",
Expand Down Expand Up @@ -1047,6 +1101,59 @@
}
}
},
"CompositeConstraint": {
"node": {
"kind": "group",
"document": [
"line",
{
"kind": "text",
"text": "("
},
{
"kind": "recurse_field",
"field": "f_constraints"
},
{
"kind": "text",
"text": ")"
}
]
}
},
"CompositeConstraintAssoc": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_ids"
},
{
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_constraint_expr"
}
}
]
},
"fields": {
"f_ids": {
"kind": "align",
"width": 2,
"contents": [
"recurse",
"whitespace",
{
"kind": "text",
"text": "=>"
},
"line"
]
}
}
},
"ConcatOp": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -2476,14 +2583,19 @@
"kind": "recurse_field",
"field": "f_iter_expr"
},
"line",
{
"kind": "recurse_field",
"field": "f_iter_filter"
}
]
}
]
},
"fields": {
"f_iter_filter": [
"line",
"recurse"
]
}
},
"ForLoopStmt": {
Expand Down Expand Up @@ -5748,4 +5860,4 @@
}
},
"max_empty_lines": 1
}
}
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/call_stmt/param_align/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Foo
(AAAA => Foo_1,
BB => Foo_2,
CCCCCCC => Foo_3,
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD => 7);
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/call_stmt/param_align/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Foo
(AAAA => Foo_1,
BB => Foo_2,
CCCCCCC => Foo_3,
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD => 7);
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/call_stmt/param_align/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
driver: unparser
rule: stmt
description: |
Base test for a `CallStmt`. Tests that if the statement is too long, the
underlying `CallExpr` breaks. Additionally, this test checks this behaviour
when the `;` is at the line length limit.
3 changes: 3 additions & 0 deletions testsuite/tests/unparsing/for_loop_stmt/array_init/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for I in My_Tasks'Range loop
My_Tasks (I).Start (I);
end loop;
3 changes: 3 additions & 0 deletions testsuite/tests/unparsing/for_loop_stmt/array_init/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for I in My_Tasks'Range loop
My_Tasks (I).Start (I);
end loop;
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/for_loop_stmt/array_init/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: stmt
description: |
Test that no line breaks are added.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Max : not null Person_Name := new Person(Sex=>M);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Max : not null Person_Name := new Person (Sex => M);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: object_decl
description: |
Base test case for a short `ObjectDecl`.
2 changes: 1 addition & 1 deletion testsuite/tests/unparsing/single_protected_decl/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ protected Shared_Array is
function Component (N : in Index) return Item;
procedure Set_Component (N : in Index; E : in Item);
private
Table : Item_Array(Index) := (others => Null_Item);
Table : Item_Array (Index) := (others => Null_Item);
end Shared_Array;
3 changes: 3 additions & 0 deletions testsuite/tests/unparsing/subp_decl/abstract/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
procedure Take(Element : out Element_Type;
From : in out Set) is abstract;

1 change: 1 addition & 0 deletions testsuite/tests/unparsing/subp_decl/abstract/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
procedure Take (Element : out Element_Type; From : in out Set) is abstract;
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/subp_decl/abstract/test.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 065dba8

Please sign in to comment.