Skip to content

Commit

Permalink
Simplify QualExpr tests and fix nested QualExprs config
Browse files Browse the repository at this point in the history
Only two tests were kept: short and long QualExpr. If 'f_r_expr' is an
Aggregate or BracketAggregate is not important for QualExpr.

A test was added to Aggregate to make sure nested QualExpr, or more
generaly, nested AggregateAssoc work as expected.
  • Loading branch information
joaopsazevedo committed Jul 29, 2024
1 parent e951332 commit 2f6f9c5
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 28 deletions.
7 changes: 5 additions & 2 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@
"field": "f_designators"
},
{
"kind": "recurse_field",
"field": "f_r_expr"
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_r_expr"
}
}
],
"fields": {
Expand Down
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/aggregate/nested/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Formatted_Edits'
(Unit => Unit,
Edit => Text_Edit'(Location => Text_Edit_Sloc, Text => Prettier_Ada.Documents.Format (Long_Document, Format_Options)),
Formatted => Enclosing_Node,
Diagnostics => Diagnostics)
9 changes: 9 additions & 0 deletions testsuite/tests/unparsing/aggregate/nested/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Formatted_Edits'
(Unit => Unit,
Edit =>
Text_Edit'
(Location => Text_Edit_Sloc,
Text =>
Prettier_Ada.Documents.Format (Long_Document, Format_Options)),
Formatted => Enclosing_Node,
Diagnostics => Diagnostics)
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/aggregate/nested/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of a qualified expression inside another
qualified expression.
driver: unparser
rule: expr
6 changes: 0 additions & 6 deletions testsuite/tests/unparsing/qual_expr/expr_1/test.yaml

This file was deleted.

1 change: 0 additions & 1 deletion testsuite/tests/unparsing/qual_expr/expr_2/input.ada

This file was deleted.

1 change: 0 additions & 1 deletion testsuite/tests/unparsing/qual_expr/expr_2/test.out

This file was deleted.

6 changes: 0 additions & 6 deletions testsuite/tests/unparsing/qual_expr/expr_2/test.yaml

This file was deleted.

1 change: 0 additions & 1 deletion testsuite/tests/unparsing/qual_expr/expr_3/input.ada

This file was deleted.

1 change: 0 additions & 1 deletion testsuite/tests/unparsing/qual_expr/expr_3/test.out

This file was deleted.

6 changes: 0 additions & 6 deletions testsuite/tests/unparsing/qual_expr/expr_3/test.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion testsuite/tests/unparsing/qual_expr/long/input.ada
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName'[Val1,Val2]
VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName'
[Val_11111111111111111111111111111,
Val22222222222222222222222222222222222222]
3 changes: 2 additions & 1 deletion testsuite/tests/unparsing/qual_expr/long/test.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName'
[Val1, Val2]
[Val_11111111111111111111111111111,
Val22222222222222222222222222222222222222]
5 changes: 3 additions & 2 deletions testsuite/tests/unparsing/qual_expr/long/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
description: |
This test checks the formatting of a qualified expression.
It is expected the declaration breaks after `'` and the new
line be indented.
line be indented. It is also expected that the indentation of the aggregate
members is relative to the `(` token.
driver: unparser
rule: expr
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/qual_expr/short/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of a short qualified expression with
parenthesis. It is expected the qualified expression stays on a single
line.
driver: unparser
rule: expr

0 comments on commit 2f6f9c5

Please sign in to comment.