diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 82d960445..d066a78e8 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -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": { diff --git a/testsuite/tests/unparsing/aggregate/nested/input.ada b/testsuite/tests/unparsing/aggregate/nested/input.ada new file mode 100644 index 000000000..04696aeca --- /dev/null +++ b/testsuite/tests/unparsing/aggregate/nested/input.ada @@ -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) diff --git a/testsuite/tests/unparsing/aggregate/nested/test.out b/testsuite/tests/unparsing/aggregate/nested/test.out new file mode 100644 index 000000000..5a9ce02d2 --- /dev/null +++ b/testsuite/tests/unparsing/aggregate/nested/test.out @@ -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) diff --git a/testsuite/tests/unparsing/aggregate/nested/test.yaml b/testsuite/tests/unparsing/aggregate/nested/test.yaml new file mode 100644 index 000000000..67ea9e23a --- /dev/null +++ b/testsuite/tests/unparsing/aggregate/nested/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a qualified expression inside another + qualified expression. + +driver: unparser +rule: expr diff --git a/testsuite/tests/unparsing/qual_expr/expr_1/test.yaml b/testsuite/tests/unparsing/qual_expr/expr_1/test.yaml deleted file mode 100644 index b25785717..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_1/test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -description: | - This test checks the formatting of a qualified expression. - It is expected the declaration stays on a single line. - -driver: unparser -rule: expr diff --git a/testsuite/tests/unparsing/qual_expr/expr_2/input.ada b/testsuite/tests/unparsing/qual_expr/expr_2/input.ada deleted file mode 100644 index 2346aebac..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_2/input.ada +++ /dev/null @@ -1 +0,0 @@ -QualName'[Val1,Val2] diff --git a/testsuite/tests/unparsing/qual_expr/expr_2/test.out b/testsuite/tests/unparsing/qual_expr/expr_2/test.out deleted file mode 100644 index 8205083ab..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_2/test.out +++ /dev/null @@ -1 +0,0 @@ -QualName'[Val1, Val2] diff --git a/testsuite/tests/unparsing/qual_expr/expr_2/test.yaml b/testsuite/tests/unparsing/qual_expr/expr_2/test.yaml deleted file mode 100644 index b25785717..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_2/test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -description: | - This test checks the formatting of a qualified expression. - It is expected the declaration stays on a single line. - -driver: unparser -rule: expr diff --git a/testsuite/tests/unparsing/qual_expr/expr_3/input.ada b/testsuite/tests/unparsing/qual_expr/expr_3/input.ada deleted file mode 100644 index b8d336605..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_3/input.ada +++ /dev/null @@ -1 +0,0 @@ -QualName'[others => False] diff --git a/testsuite/tests/unparsing/qual_expr/expr_3/test.out b/testsuite/tests/unparsing/qual_expr/expr_3/test.out deleted file mode 100644 index b8d336605..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_3/test.out +++ /dev/null @@ -1 +0,0 @@ -QualName'[others => False] diff --git a/testsuite/tests/unparsing/qual_expr/expr_3/test.yaml b/testsuite/tests/unparsing/qual_expr/expr_3/test.yaml deleted file mode 100644 index b25785717..000000000 --- a/testsuite/tests/unparsing/qual_expr/expr_3/test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -description: | - This test checks the formatting of a qualified expression. - It is expected the declaration stays on a single line. - -driver: unparser -rule: expr diff --git a/testsuite/tests/unparsing/qual_expr/long/input.ada b/testsuite/tests/unparsing/qual_expr/long/input.ada index 5d82cac22..3d5e38717 100644 --- a/testsuite/tests/unparsing/qual_expr/long/input.ada +++ b/testsuite/tests/unparsing/qual_expr/long/input.ada @@ -1 +1,3 @@ -VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName'[Val1,Val2] +VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName' + [Val_11111111111111111111111111111, + Val22222222222222222222222222222222222222] diff --git a/testsuite/tests/unparsing/qual_expr/long/test.out b/testsuite/tests/unparsing/qual_expr/long/test.out index 975affff4..3d5e38717 100644 --- a/testsuite/tests/unparsing/qual_expr/long/test.out +++ b/testsuite/tests/unparsing/qual_expr/long/test.out @@ -1,2 +1,3 @@ VeeeeeeeeeeeeeeeeeeeerrrrrrrrrrryLooooooooooooooooooooonnnnnnnngQualName' - [Val1, Val2] + [Val_11111111111111111111111111111, + Val22222222222222222222222222222222222222] diff --git a/testsuite/tests/unparsing/qual_expr/long/test.yaml b/testsuite/tests/unparsing/qual_expr/long/test.yaml index 18e28548c..41311f0e2 100644 --- a/testsuite/tests/unparsing/qual_expr/long/test.yaml +++ b/testsuite/tests/unparsing/qual_expr/long/test.yaml @@ -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 diff --git a/testsuite/tests/unparsing/qual_expr/expr_1/input.ada b/testsuite/tests/unparsing/qual_expr/short/input.ada similarity index 100% rename from testsuite/tests/unparsing/qual_expr/expr_1/input.ada rename to testsuite/tests/unparsing/qual_expr/short/input.ada diff --git a/testsuite/tests/unparsing/qual_expr/expr_1/test.out b/testsuite/tests/unparsing/qual_expr/short/test.out similarity index 100% rename from testsuite/tests/unparsing/qual_expr/expr_1/test.out rename to testsuite/tests/unparsing/qual_expr/short/test.out diff --git a/testsuite/tests/unparsing/qual_expr/short/test.yaml b/testsuite/tests/unparsing/qual_expr/short/test.yaml new file mode 100644 index 000000000..ec7407f39 --- /dev/null +++ b/testsuite/tests/unparsing/qual_expr/short/test.yaml @@ -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