From a74ea0e773f8fd09f42e3d80345eee1ed630d1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Azevedo?= Date: Thu, 7 Mar 2024 11:24:14 +0000 Subject: [PATCH] Unparsing: add GenericPackageInstantion and GenericSubInstantiation configs --- extensions/default_unparsing_config.json | 257 +++++++-- .../doc-baseline.json | 148 +++-- .../call_expr/long_name/doc-baseline.json | 47 +- .../call_expr/long_suffix/doc-baseline.json | 47 +- .../short_name_and_suffix/doc-baseline.json | 47 +- .../unparsing/call_stmt/doc-baseline.json | 53 +- .../long/doc-baseline.json | 79 +++ .../long/input.ada | 1 + .../long/test.out | 2 + .../long/test.yaml | 5 + .../long_with_params/doc-baseline.json | 490 +++++++++++++++++ .../long_with_params/input.ada | 9 + .../long_with_params/test.out | 10 + .../long_with_params/test.yaml | 6 + .../short/doc-baseline.json | 79 +++ .../short/input.ada | 1 + .../short/test.out | 1 + .../short/test.yaml | 5 + .../short_with_params/doc-baseline.json | 210 ++++++++ .../short_with_params/input.ada | 2 + .../short_with_params/test.out | 1 + .../short_with_params/test.yaml | 5 + .../long/doc-baseline.json | 95 ++++ .../generic_subp_instantiation/long/input.ada | 1 + .../generic_subp_instantiation/long/test.out | 2 + .../generic_subp_instantiation/long/test.yaml | 5 + .../long_with_params/doc-baseline.json | 506 ++++++++++++++++++ .../long_with_params/input.ada | 9 + .../long_with_params/test.out | 10 + .../long_with_params/test.yaml | 6 + .../short/doc-baseline.json | 95 ++++ .../short/input.ada | 1 + .../generic_subp_instantiation/short/test.out | 1 + .../short/test.yaml | 5 + .../short_with_params/doc-baseline.json | 226 ++++++++ .../short_with_params/input.ada | 2 + .../short_with_params/test.out | 1 + .../short_with_params/test.yaml | 5 + 38 files changed, 2380 insertions(+), 95 deletions(-) create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long/input.ada create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long/test.out create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long/test.yaml create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long_with_params/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long_with_params/input.ada create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.yaml create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short/input.ada create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short/test.out create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short/test.yaml create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short_with_params/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short_with_params/input.ada create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.out create mode 100644 testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.yaml create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long/input.ada create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long/test.out create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long/test.yaml create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/input.ada create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.yaml create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short/input.ada create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short/test.out create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short/test.yaml create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/doc-baseline.json create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/input.ada create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.out create mode 100644 testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.yaml diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 256fd56a0..e260fe49b 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -131,6 +131,12 @@ } } }, + "AssocList": { + "sep": [ + "recurse", + "line" + ] + }, "BaseAssocList": { "sep": [ "recurse", @@ -350,7 +356,7 @@ "document": { "kind": "recurse_field", "field": "f_ids" - } + } }, "whitespace", { @@ -394,7 +400,7 @@ "line", "recurse" ], - "f_aspects":[ + "f_aspects": [ "line", "recurse" ] @@ -427,17 +433,17 @@ "node": { "kind": "group", "document": [ - { - "kind": "recurse_field", - "field": "f_components" - }, - { - "kind": "recurse_field", - "field": "f_variant_part" - } - ] + { + "kind": "recurse_field", + "field": "f_components" + }, + { + "kind": "recurse_field", + "field": "f_variant_part" + } + ] }, - "fields":{ + "fields": { "f_components": { "kind": "ifEmpty", "then": "recurse", @@ -583,7 +589,7 @@ } ] } - }, + }, "DecimalFixedPointDef": { "node": { "kind": "group", @@ -916,6 +922,91 @@ ] } }, + "GenericSubpInstantiation": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_overriding" + }, + { + "kind": "group", + "document": { + "kind": "align", + "width": 2, + "contents": [ + { + "kind": "recurse_field", + "field": "f_kind" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_subp_name" + }, + "whitespace", + { + "kind": "text", + "text": "is" + }, + "whitespace", + { + "kind": "text", + "text": "new" + }, + "line", + { + "kind": "group", + "document": { + "kind": "align", + "width": 2, + "contents": [ + { + "kind": "recurse_field", + "field": "f_generic_subp_name" + }, + { + "kind": "recurse_field", + "field": "f_params" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ] + } + }, + { + "kind": "text", + "text": ";" + } + ] + } + } + ] + }, + "fields": { + "f_params": [ + "line", + { + "kind": "align", + "width": 1, + "contents": [ + { + "kind": "text", + "text": "(" + }, + "recurse", + { + "kind": "text", + "text": ")" + } + ] + } + ] + } + }, "GenericPackageDecl": { "node": { "kind": "group", @@ -932,6 +1023,82 @@ ] } }, + "GenericPackageInstantiation": { + "node": { + "kind": "group", + "document": { + "kind": "align", + "width": 2, + "contents": [ + { + "kind": "text", + "text": "package" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + "whitespace", + { + "kind": "text", + "text": "is" + }, + "whitespace", + { + "kind": "text", + "text": "new" + }, + "line", + { + "kind": "group", + "document": { + "kind": "align", + "width": 2, + "contents": [ + { + "kind": "recurse_field", + "field": "f_generic_pkg_name" + }, + { + "kind": "recurse_field", + "field": "f_params" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ] + } + }, + { + "kind": "text", + "text": ";" + } + ] + } + }, + "fields": { + "f_params": [ + "line", + { + "kind": "align", + "width": 1, + "contents": [ + { + "kind": "text", + "text": "(" + }, + "recurse", + { + "kind": "text", + "text": ")" + } + ] + } + ] + } + }, "GenericPackageInternal": { "node": [ { @@ -1092,29 +1259,29 @@ "node": { "kind": "group", "document": [ - "line", + "line", { "kind": "text", "text": "(" }, { "kind": "align", - "width": 1, + "width": 1, "contents": { "kind": "group", - "document" : [ + "document": [ { "kind": "recurse_field", "field": "f_discr_specs" } - ] - } + ] + } }, { "kind": "text", "text": ")" } - ] + ] } }, "NameList": { @@ -1126,12 +1293,12 @@ "NullRecordDef": { "node": { "kind": "group", - "document": [ + "document": [ { "kind": "text", "text": "null" }, - "whitespace", + "whitespace", { "kind": "text", "text": "record" @@ -1139,7 +1306,7 @@ { "kind": "recurse_field", "field": "f_components" - } + } ] } }, @@ -1535,6 +1702,36 @@ ] } }, + "ParamAssoc": { + "node": { + "kind": "group", + "document": { + "kind": "align", + "width": 2, + "contents": [ + { + "kind": "recurse_field", + "field": "f_designator" + }, + { + "kind": "recurse_field", + "field": "f_r_expr" + } + ] + } + }, + "fields": { + "f_designator": [ + "recurse", + "whitespace", + { + "kind": "text", + "text": "=>" + }, + "line" + ] + } + }, "Params": { "node": { "kind": "group", @@ -1814,16 +2011,16 @@ "RecordDef": { "node": { "kind": "group", - "document": [ + "document": [ "breakParent", { "kind": "align", "width": 2, - "contents": [ + "contents": [ { "kind": "text", "text": "record" - }, + }, { "kind": "recurse_field", "field": "f_components" @@ -1838,14 +2035,14 @@ "kind": "text", "text": "end" }, - "whitespace", + "whitespace", { "kind": "text", "text": "record" } ] } - ] + ] } }, "RecordTypeDef": { @@ -2060,7 +2257,7 @@ { "kind": "text", "text": "access" - }, + }, { "kind": "recurse_field", "field": "f_has_all" @@ -2215,7 +2412,7 @@ { "kind": "recurse_field", "field": "f_components" - } + } ] } } @@ -2232,7 +2429,7 @@ "node": [ { "kind": "group", - "document": [ + "document": [ [ { "kind": "text", diff --git a/testsuite/tests/unparsing/call_expr/call_expr_inside_call_expr/doc-baseline.json b/testsuite/tests/unparsing/call_expr/call_expr_inside_call_expr/doc-baseline.json index 35dcd3108..d13598894 100644 --- a/testsuite/tests/unparsing/call_expr/call_expr_inside_call_expr/doc-baseline.json +++ b/testsuite/tests/unparsing/call_expr/call_expr_inside_call_expr/doc-baseline.json @@ -1,5 +1,5 @@ { - "id": 14, + "id": 22, "kind": "command", "command": { "command": "align", @@ -7,7 +7,7 @@ "kind": "innerRoot" }, "alignContents": { - "id": 13, + "id": 21, "kind": "command", "command": { "command": "align", @@ -16,13 +16,13 @@ "n": 2 }, "alignContents": { - "id": 12, + "id": 20, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 11, + "id": 19, "kind": "list", "list": [ { @@ -46,15 +46,13 @@ "text": "(" }, { - "id": 9, + "id": 17, "kind": "command", "command": { - "command": "align", - "alignData": { - "kind": "innerRoot" - }, - "alignContents": { - "id": 8, + "command": "group", + "id": 0, + "groupContents": { + "id": 16, "kind": "command", "command": { "command": "align", @@ -63,47 +61,113 @@ "n": 2 }, "alignContents": { - "id": 7, - "kind": "command", - "command": { - "command": "group", - "id": 0, - "groupContents": { - "id": 6, - "kind": "list", - "list": [ - { - "id": 3, - "kind": "text", - "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + "id": 15, + "kind": "list", + "list": [ + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" }, - { - "id": 4, + "alignContents": { + "id": 13, "kind": "command", "command": { - "command": "line", - "literal": false, - "soft": false, - "hard": false + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + }, + { + "id": 4, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 5, + "kind": "text", + "text": "(" + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 10, + "kind": "text", + "text": ")" + } + ] + }, + "break": false, + "expandedStates": null + } + } } - }, - { - "id": 5, - "kind": "text", - "text": "(Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz)" } - ] - }, - "break": false, - "expandedStates": null - } + } + } + ] } } - } + }, + "break": false, + "expandedStates": null } }, { - "id": 10, + "id": 18, "kind": "text", "text": ")" } diff --git a/testsuite/tests/unparsing/call_expr/long_name/doc-baseline.json b/testsuite/tests/unparsing/call_expr/long_name/doc-baseline.json index 8d601b994..00291a467 100644 --- a/testsuite/tests/unparsing/call_expr/long_name/doc-baseline.json +++ b/testsuite/tests/unparsing/call_expr/long_name/doc-baseline.json @@ -1,5 +1,5 @@ { - "id": 6, + "id": 11, "kind": "command", "command": { "command": "align", @@ -7,7 +7,7 @@ "kind": "innerRoot" }, "alignContents": { - "id": 5, + "id": 10, "kind": "command", "command": { "command": "align", @@ -16,13 +16,13 @@ "n": 2 }, "alignContents": { - "id": 4, + "id": 9, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 3, + "id": 8, "kind": "list", "list": [ { @@ -43,7 +43,44 @@ { "id": 2, "kind": "text", - "text": "(Bar)" + "text": "(" + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "text", + "text": "Bar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": ")" } ] }, diff --git a/testsuite/tests/unparsing/call_expr/long_suffix/doc-baseline.json b/testsuite/tests/unparsing/call_expr/long_suffix/doc-baseline.json index 4b53afd5b..c1500b474 100644 --- a/testsuite/tests/unparsing/call_expr/long_suffix/doc-baseline.json +++ b/testsuite/tests/unparsing/call_expr/long_suffix/doc-baseline.json @@ -1,5 +1,5 @@ { - "id": 6, + "id": 11, "kind": "command", "command": { "command": "align", @@ -7,7 +7,7 @@ "kind": "innerRoot" }, "alignContents": { - "id": 5, + "id": 10, "kind": "command", "command": { "command": "align", @@ -16,13 +16,13 @@ "n": 2 }, "alignContents": { - "id": 4, + "id": 9, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 3, + "id": 8, "kind": "list", "list": [ { @@ -43,7 +43,44 @@ { "id": 2, "kind": "text", - "text": "(Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar)" + "text": "(" + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": ")" } ] }, diff --git a/testsuite/tests/unparsing/call_expr/short_name_and_suffix/doc-baseline.json b/testsuite/tests/unparsing/call_expr/short_name_and_suffix/doc-baseline.json index 4523ce742..2174f701e 100644 --- a/testsuite/tests/unparsing/call_expr/short_name_and_suffix/doc-baseline.json +++ b/testsuite/tests/unparsing/call_expr/short_name_and_suffix/doc-baseline.json @@ -1,5 +1,5 @@ { - "id": 6, + "id": 11, "kind": "command", "command": { "command": "align", @@ -7,7 +7,7 @@ "kind": "innerRoot" }, "alignContents": { - "id": 5, + "id": 10, "kind": "command", "command": { "command": "align", @@ -16,13 +16,13 @@ "n": 2 }, "alignContents": { - "id": 4, + "id": 9, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 3, + "id": 8, "kind": "list", "list": [ { @@ -43,7 +43,44 @@ { "id": 2, "kind": "text", - "text": "(Bar)" + "text": "(" + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "text", + "text": "Bar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": ")" } ] }, diff --git a/testsuite/tests/unparsing/call_stmt/doc-baseline.json b/testsuite/tests/unparsing/call_stmt/doc-baseline.json index cd9c97cee..9e9ca9545 100644 --- a/testsuite/tests/unparsing/call_stmt/doc-baseline.json +++ b/testsuite/tests/unparsing/call_stmt/doc-baseline.json @@ -1,15 +1,15 @@ { - "id": 9, + "id": 14, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 8, + "id": 13, "kind": "list", "list": [ { - "id": 6, + "id": 11, "kind": "command", "command": { "command": "align", @@ -17,7 +17,7 @@ "kind": "innerRoot" }, "alignContents": { - "id": 5, + "id": 10, "kind": "command", "command": { "command": "align", @@ -26,13 +26,13 @@ "n": 2 }, "alignContents": { - "id": 4, + "id": 9, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 3, + "id": 8, "kind": "list", "list": [ { @@ -53,7 +53,44 @@ { "id": 2, "kind": "text", - "text": "(Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar)" + "text": "(" + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 7, + "kind": "text", + "text": ")" } ] }, @@ -66,7 +103,7 @@ } }, { - "id": 7, + "id": 12, "kind": "text", "text": ";" } diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long/doc-baseline.json b/testsuite/tests/unparsing/generic_package_instantiation/long/doc-baseline.json new file mode 100644 index 000000000..cb47f4459 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long/doc-baseline.json @@ -0,0 +1,79 @@ +{ + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "package Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long/input.ada b/testsuite/tests/unparsing/generic_package_instantiation/long/input.ada new file mode 100644 index 000000000..beb17f72f --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long/input.ada @@ -0,0 +1 @@ +package Foo is new Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long/test.out b/testsuite/tests/unparsing/generic_package_instantiation/long/test.out new file mode 100644 index 000000000..9ecf8aa79 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long/test.out @@ -0,0 +1,2 @@ +package Foo is new + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long/test.yaml b/testsuite/tests/unparsing/generic_package_instantiation/long/test.yaml new file mode 100644 index 000000000..f9a653eb3 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Test line breaks after the `new` keyword and the continuation line + indentation for `f_generic_pkg_name`. diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/doc-baseline.json b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/doc-baseline.json new file mode 100644 index 000000000..c3786a6da --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/doc-baseline.json @@ -0,0 +1,490 @@ +{ + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 60, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "package Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 58, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Baaaaaaaaaar" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 6, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "text", + "text": "Qux" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 9, + "kind": "text", + "text": "," + }, + { + "id": 10, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 13, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": "\"-j\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 15, + "kind": "text", + "text": "," + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "text", + "text": "\"--jobs\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 21, + "kind": "text", + "text": "," + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 26, + "kind": "list", + "list": [ + { + "id": 23, + "kind": "text", + "text": "Garply =>" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 25, + "kind": "text", + "text": "Natural" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 29, + "kind": "text", + "text": "," + }, + { + "id": 30, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 36, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "Corge =>" + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "text", + "text": "1" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 37, + "kind": "text", + "text": "," + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 42, + "kind": "list", + "list": [ + { + "id": 39, + "kind": "text", + "text": "Fred =>" + }, + { + "id": 40, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 41, + "kind": "text", + "text": "\"Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": "," + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 52, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 51, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 50, + "kind": "list", + "list": [ + { + "id": 47, + "kind": "text", + "text": "Bar =>" + }, + { + "id": 48, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 49, + "kind": "text", + "text": "Bar_Foo" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 53, + "kind": "text", + "text": ")" + } + ] + } + } + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 59, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/input.ada b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/input.ada new file mode 100644 index 000000000..37135bf81 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/input.ada @@ -0,0 +1,9 @@ +package Foo is new + Baaaaaaaaaar + (Qux, + "-j", + "--jobs", + Garply => Natural, + Corge => 1, + Fred => "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", + Bar => Bar_Foo); 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 new file mode 100644 index 000000000..ddcdeb5d8 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.out @@ -0,0 +1,10 @@ +package Foo is new + Baaaaaaaaaar + (Qux, + "-j", + "--jobs", + Garply => Natural, + Corge => 1, + Fred => + "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", + Bar => Bar_Foo); diff --git a/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.yaml b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.yaml new file mode 100644 index 000000000..ffecb0837 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/long_with_params/test.yaml @@ -0,0 +1,6 @@ +driver: unparser +rule: generic_instantiation +description: | + Test line breaks after the `new` keyword and between `f_generic_pkg_name` and + `f_params`. Also test continuation line indentation for the + `f_generic_pkg_name`, `f_params` and each parameter of the latter. diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short/doc-baseline.json b/testsuite/tests/unparsing/generic_package_instantiation/short/doc-baseline.json new file mode 100644 index 000000000..8568a902b --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short/doc-baseline.json @@ -0,0 +1,79 @@ +{ + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "package Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Bar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short/input.ada b/testsuite/tests/unparsing/generic_package_instantiation/short/input.ada new file mode 100644 index 000000000..94e1e4702 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short/input.ada @@ -0,0 +1 @@ +package Foo is new Bar; diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short/test.out b/testsuite/tests/unparsing/generic_package_instantiation/short/test.out new file mode 100644 index 000000000..94e1e4702 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short/test.out @@ -0,0 +1 @@ +package Foo is new Bar; diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short/test.yaml b/testsuite/tests/unparsing/generic_package_instantiation/short/test.yaml new file mode 100644 index 000000000..b061de465 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Base test for a short instantiation without parameters. Test that there are + no line breaks. diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/doc-baseline.json b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/doc-baseline.json new file mode 100644 index 000000000..a684bbecb --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/doc-baseline.json @@ -0,0 +1,210 @@ +{ + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "package Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Bar" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 6, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "text", + "text": "\"Baz\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 9, + "kind": "text", + "text": "," + }, + { + "id": 10, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 15, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 14, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": "Qux =>" + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 13, + "kind": "text", + "text": "Corge" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 17, + "kind": "text", + "text": ")" + } + ] + } + } + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/input.ada b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/input.ada new file mode 100644 index 000000000..c4d170ab6 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/input.ada @@ -0,0 +1,2 @@ +package Foo is new Bar ("Baz", Qux => Corge); + diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.out b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.out new file mode 100644 index 000000000..1b7bf6412 --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.out @@ -0,0 +1 @@ +package Foo is new Bar ("Baz", Qux => Corge); diff --git a/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.yaml b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.yaml new file mode 100644 index 000000000..460ab66ca --- /dev/null +++ b/testsuite/tests/unparsing/generic_package_instantiation/short_with_params/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Base test for a short instantiation with parameters. Test that there are no + line breaks. diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long/doc-baseline.json b/testsuite/tests/unparsing/generic_subp_instantiation/long/doc-baseline.json new file mode 100644 index 000000000..02094a9aa --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long/doc-baseline.json @@ -0,0 +1,95 @@ +{ + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long/input.ada b/testsuite/tests/unparsing/generic_subp_instantiation/long/input.ada new file mode 100644 index 000000000..044108c26 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long/input.ada @@ -0,0 +1 @@ +procedure Foo is new Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long/test.out b/testsuite/tests/unparsing/generic_subp_instantiation/long/test.out new file mode 100644 index 000000000..ecc3f10b6 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long/test.out @@ -0,0 +1,2 @@ +procedure Foo is new + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long/test.yaml b/testsuite/tests/unparsing/generic_subp_instantiation/long/test.yaml new file mode 100644 index 000000000..aa38a7346 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Test line breaks after the `new` keyword and the continuation line + indentation for `f_generic_subp_name`. diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/doc-baseline.json b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/doc-baseline.json new file mode 100644 index 000000000..07723ce79 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/doc-baseline.json @@ -0,0 +1,506 @@ +{ + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 60, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 58, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Baaaaaaaaaar" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 6, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "text", + "text": "Qux" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 9, + "kind": "text", + "text": "," + }, + { + "id": 10, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 13, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": "\"-j\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 15, + "kind": "text", + "text": "," + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "text", + "text": "\"--jobs\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 21, + "kind": "text", + "text": "," + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 26, + "kind": "list", + "list": [ + { + "id": 23, + "kind": "text", + "text": "Garply =>" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 25, + "kind": "text", + "text": "Natural" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 29, + "kind": "text", + "text": "," + }, + { + "id": 30, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 36, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "Corge =>" + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "text", + "text": "1" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 37, + "kind": "text", + "text": "," + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 42, + "kind": "list", + "list": [ + { + "id": 39, + "kind": "text", + "text": "Fred =>" + }, + { + "id": 40, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 41, + "kind": "text", + "text": "\"Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": "," + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 52, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 51, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 50, + "kind": "list", + "list": [ + { + "id": 47, + "kind": "text", + "text": "Bar =>" + }, + { + "id": 48, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 49, + "kind": "text", + "text": "Bar_Foo" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 53, + "kind": "text", + "text": ")" + } + ] + } + } + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 59, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/input.ada b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/input.ada new file mode 100644 index 000000000..dba7e4deb --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/input.ada @@ -0,0 +1,9 @@ +function Foo is new + Baaaaaaaaaar + (Qux, + "-j", + "--jobs", + Garply => Natural, + Corge => 1, + Fred => "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", + Bar => Bar_Foo); 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 new file mode 100644 index 000000000..8fadcba84 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.out @@ -0,0 +1,10 @@ +function Foo is new + Baaaaaaaaaar + (Qux, + "-j", + "--jobs", + Garply => Natural, + Corge => 1, + Fred => + "Maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax", + Bar => Bar_Foo); diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.yaml b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.yaml new file mode 100644 index 000000000..9fa2ecfb0 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/long_with_params/test.yaml @@ -0,0 +1,6 @@ +driver: unparser +rule: generic_instantiation +description: | + Test line breaks after the `new` keyword and between `f_generic_subp_name` + and `f_params`. Also test continuation line indentation for the + `f_generic_subp_name`, `f_params` and each parameter of the latter. diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short/doc-baseline.json b/testsuite/tests/unparsing/generic_subp_instantiation/short/doc-baseline.json new file mode 100644 index 000000000..f5487eab9 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short/doc-baseline.json @@ -0,0 +1,95 @@ +{ + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "function Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Bar" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short/input.ada b/testsuite/tests/unparsing/generic_subp_instantiation/short/input.ada new file mode 100644 index 000000000..3dea7bf18 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short/input.ada @@ -0,0 +1 @@ +function Foo is new Bar; diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short/test.out b/testsuite/tests/unparsing/generic_subp_instantiation/short/test.out new file mode 100644 index 000000000..3dea7bf18 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short/test.out @@ -0,0 +1 @@ +function Foo is new Bar; diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short/test.yaml b/testsuite/tests/unparsing/generic_subp_instantiation/short/test.yaml new file mode 100644 index 000000000..b061de465 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Base test for a short instantiation without parameters. Test that there are + no line breaks. diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/doc-baseline.json b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/doc-baseline.json new file mode 100644 index 000000000..454600c03 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/doc-baseline.json @@ -0,0 +1,226 @@ +{ + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo is new" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "Bar" + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "(" + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 6, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "text", + "text": "\"Baz\"" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 9, + "kind": "text", + "text": "," + }, + { + "id": 10, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 15, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 14, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": "Qux =>" + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 13, + "kind": "text", + "text": "Corge" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 17, + "kind": "text", + "text": ")" + } + ] + } + } + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/input.ada b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/input.ada new file mode 100644 index 000000000..c444b29e7 --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/input.ada @@ -0,0 +1,2 @@ +procedure Foo is new Bar ("Baz", Qux => Corge); + diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.out b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.out new file mode 100644 index 000000000..bc06be36b --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.out @@ -0,0 +1 @@ +procedure Foo is new Bar ("Baz", Qux => Corge); diff --git a/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.yaml b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.yaml new file mode 100644 index 000000000..460ab66ca --- /dev/null +++ b/testsuite/tests/unparsing/generic_subp_instantiation/short_with_params/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: generic_instantiation +description: | + Base test for a short instantiation with parameters. Test that there are no + line breaks.