diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 3e00abeed..13be671e3 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -601,26 +601,179 @@ }, "BinOp": { "node": { - "kind": "group", - "document": [ + "kind": "ifKind", + "field": "f_op", + "default": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [] + }, + { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + } + ] + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] + } + ] + }, + "matchers": [ { - "kind": "recurse_field", - "field": "f_left" + "kind": "OpAnd", + "document": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] + } }, - "line", { - "kind": "recurse_field", - "field": "f_op" + "kind": "OpAndThen", + "document": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] + } }, - "whitespace", { - "kind": "innerRoot", - "contents": { - "kind": "recurse_field", - "field": "f_right" + "kind": "OpOr", + "document": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] + } + }, + { + "kind": "OpOrElse", + "document": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] + } + }, + { + "kind": "OpXor", + "document": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] } } ] + }, + "fields": { + "f_left": { + "kind": "recurse_flatten", + "if": [ + "BinOp" + ] + } } }, "BracketAggregate": { @@ -1609,6 +1762,42 @@ ] } }, + "DeclExpr": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "declare" + }, + { + "kind": "continuationLineIndent", + "contents": [ + "hardline", + { + "kind": "recurse_field", + "field": "f_decls" + } + ] + }, + "hardline", + { + "kind": "text", + "text": "begin" + }, + { + "kind": "continuationLineIndent", + "contents": [ + "hardline", + { + "kind": "recurse_field", + "field": "f_expr" + } + ] + } + ] + } + }, "DeclList": { "sep": [ "recurse", @@ -2258,8 +2447,7 @@ "field": "f_stmts" } ] - }, - "hardlineWithoutBreakParent" + } ] } }, @@ -2269,6 +2457,12 @@ "line" ] }, + "ElsifStmtPartList": { + "sep": [ + "recurse", + "hardlineWithoutBreakParent" + ] + }, "ExceptionDecl": { "node": { "kind": "group", @@ -3423,8 +3617,11 @@ { "kind": "continuationLineIndent", "contents": { - "kind": "recurse_field", - "field": "f_cond_expr" + "kind": "group", + "document": { + "kind": "recurse_field", + "field": "f_cond_expr" + } } }, "line", @@ -3470,18 +3667,34 @@ }, "fields": { "f_alternatives": { - "kind": "group", - "document": "recurse" + "kind": "ifEmpty", + "then": "recurse", + "else": [ + "recurse", + "hardlineWithoutBreakParent" + ] }, "f_else_stmts": [ { - "kind": "indent", - "contents": [ - "hardlineWithoutBreakParent", + "kind": "text", + "text": "else" + }, + { + "kind": "ifEmpty", + "then": [ "recurse" + ], + "else": [ + { + "kind": "indent", + "contents": [ + "hardlineWithoutBreakParent", + "recurse" + ] + }, + "hardlineWithoutBreakParent" ] - }, - "hardlineWithoutBreakParent" + } ] } }, @@ -3786,11 +3999,12 @@ "kind": "recurse_field", "field": "f_decl" }, + "whitespace", { "kind": "text", "text": ":" }, - "hardlineWithoutBreakParent", + "hardline", { "kind": "recurse_field", "field": "f_stmt" @@ -3957,6 +4171,25 @@ "whitespace" ] }, + "ModIntTypeDef": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "mod" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_expr" + } + } + ] + } + }, "NoTypeObjectRenamingDecl": { "node": { "kind": "continuationLineIndent", @@ -4748,12 +4981,24 @@ }, "ParenExpr": { "node": { - "kind": "align", - "width": " ", - "contents": { - "kind": "group", - "document": "recurse" - } + "kind": "group", + "document": [ + { + "kind": "text", + "text": "(" + }, + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_expr" + } + }, + { + "kind": "text", + "text": ")" + } + ] } }, "ParentList": { @@ -5221,8 +5466,16 @@ "kind": "text", "text": "with" }, - "whitespace", - "recurse" + { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "line", + "recurse" + ] + } + } ] } } @@ -5250,6 +5503,66 @@ } } }, + "ReduceAttributeRef": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_prefix" + }, + { + "kind": "text", + "text": "'" + }, + { + "kind": "continuationLineIndent", + "contents": { + "kind": "group", + "document": [ + "softline", + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_attribute" + }, + { + "kind": "continuationLineIndent", + "contents": [ + "line", + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "(" + }, + { + "kind": "align", + "width": " ", + "contents": { + "kind": "recurse_field", + "field": "f_args" + } + }, + { + "kind": "text", + "text": ")" + } + ] + } + ] + } + ] + } + ] + } + } + ] + } + }, "RenamingClause": { "node": { "kind": "group", @@ -5397,21 +5710,30 @@ "kind": "group", "document": [ { - "kind": "recurse_field", - "field": "f_left" + "kind": "group", + "document": [] }, - "line", { - "kind": "recurse_field", - "field": "f_op" - }, - "whitespace", - { - "kind": "innerRoot", - "contents": { - "kind": "recurse_field", - "field": "f_right" - } + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_left" + }, + "line", + { + "kind": "recurse_field", + "field": "f_op" + }, + "whitespace", + { + "kind": "innerRoot", + "contents": { + "kind": "recurse_field", + "field": "f_right" + } + } + ] } ] } @@ -5420,7 +5742,7 @@ "node": { "kind": "continuationLineIndent", "contents": { - "kind": "fill", + "kind": "group", "document": "recurse" } }, @@ -5928,6 +6250,56 @@ } } }, + "SubtypeDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "subtype" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + "whitespace", + { + "kind": "text", + "text": "is" + }, + { + "kind": "continuationLineIndent", + "contents": [ + "line", + { + "kind": "recurse_field", + "field": "f_subtype" + } + ] + } + ] + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_aspects": [ + "line", + "recurse" + ] + } + }, "SubtypeIndication": { "node": { "kind": "group", @@ -6370,6 +6742,29 @@ ] } }, + "ValueSequence": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "[" + }, + { + "kind": "align", + "width": " ", + "contents": { + "kind": "recurse_field", + "field": "f_iter_assoc" + } + }, + { + "kind": "text", + "text": "]" + } + ] + } + }, "Variant": { "node": [ { diff --git a/testsuite/tests/unparsing/decl_expr/input.ada b/testsuite/tests/unparsing/decl_expr/input.ada new file mode 100644 index 000000000..dd42f7b04 --- /dev/null +++ b/testsuite/tests/unparsing/decl_expr/input.ada @@ -0,0 +1,8 @@ +function Is_Subp_Decl_An_Import_With_Expression + (Subp : Basic_Decl'Class) return Boolean +is (declare + Import_Aspect : constant Aspect := + Subp.P_Get_Aspect (Langkit_Support.Text.To_Unbounded_Text ("Import")); + begin + Exists (Import_Aspect) + and then (To_Lower (+Value (Import_Aspect).Text) /= "false")); diff --git a/testsuite/tests/unparsing/decl_expr/test.out b/testsuite/tests/unparsing/decl_expr/test.out new file mode 100644 index 000000000..dd42f7b04 --- /dev/null +++ b/testsuite/tests/unparsing/decl_expr/test.out @@ -0,0 +1,8 @@ +function Is_Subp_Decl_An_Import_With_Expression + (Subp : Basic_Decl'Class) return Boolean +is (declare + Import_Aspect : constant Aspect := + Subp.P_Get_Aspect (Langkit_Support.Text.To_Unbounded_Text ("Import")); + begin + Exists (Import_Aspect) + and then (To_Lower (+Value (Import_Aspect).Text) /= "false")); diff --git a/testsuite/tests/unparsing/decl_expr/test.yaml b/testsuite/tests/unparsing/decl_expr/test.yaml new file mode 100644 index 000000000..e07cbedd2 --- /dev/null +++ b/testsuite/tests/unparsing/decl_expr/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subp_decl +description: | + Test indentation of `f_decls` and `f_expr` on a `DeclExpr`. diff --git a/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/input.ada b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/input.ada new file mode 100644 index 000000000..eabd75eb0 --- /dev/null +++ b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/input.ada @@ -0,0 +1,49 @@ +if Subp.P_Is_Ghost_Code or else Is_Function_With_Ghost_Return (Subp) then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image & "Can't fuzz ghost code subprograms."); +elsif Subp.Kind in Ada_Abstract_Subp_Decl then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image & "Can't fuzz abstract subprograms."); +elsif Get_Subp_Params (Subp).Is_Null then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't subprograms with no parameters."); +elsif not Has_Input_Parameters (Subp) then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms with no 'in' or " + & "'in out' parameters"); +elsif Is_Subp_Decl_An_Import_With_Expression (Subp) and not Is_Intrinsic_Subprogram (Subp) then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms where Imports aspect " + & "values are derived from expressions."); +elsif Is_Subp_Decl_Null (Subp) + and not Is_Expr_Function (Subp) + and not Is_Subp_Decl_An_Import (Subp) +then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms with null " + & "specifications."); +else + null; +end if; diff --git a/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.out b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.out new file mode 100644 index 000000000..b9976be79 --- /dev/null +++ b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.out @@ -0,0 +1,50 @@ +if Subp.P_Is_Ghost_Code or else Is_Function_With_Ghost_Return (Subp) then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image & "Can't fuzz ghost code subprograms."); +elsif Subp.Kind in Ada_Abstract_Subp_Decl then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image & "Can't fuzz abstract subprograms."); +elsif Get_Subp_Params (Subp).Is_Null then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image & "Can't subprograms with no parameters."); +elsif not Has_Input_Parameters (Subp) then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms with no 'in' or " + & "'in out' parameters"); +elsif Is_Subp_Decl_An_Import_With_Expression (Subp) + and not Is_Intrinsic_Subprogram (Subp) +then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms where Imports aspect " + & "values are derived from expressions."); +elsif Is_Subp_Decl_Null (Subp) + and not Is_Expr_Function (Subp) + and not Is_Subp_Decl_An_Import (Subp) +then + return + Non_Fuzzable_Subprogram' + (Declaration => Subp.As_Basic_Decl, + Reason => + +Subp.Full_Sloc_Image + & "Can't fuzz subprograms with null " + & "specifications."); +else + null; +end if; diff --git a/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.yaml b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.yaml new file mode 100644 index 000000000..ff13beb17 --- /dev/null +++ b/testsuite/tests/unparsing/if_stmt/long_last_elsif_cond_expr/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: stmt +description: | + Test that if the last `ElsifStmtPart` is long, it first breaks before the + `then` keyword and then the underlying `f_cond_expr` field. diff --git a/testsuite/tests/unparsing/named_stmt/test.out b/testsuite/tests/unparsing/named_stmt/test.out index 74baccdfc..18cc9c0fa 100644 --- a/testsuite/tests/unparsing/named_stmt/test.out +++ b/testsuite/tests/unparsing/named_stmt/test.out @@ -1,4 +1,4 @@ -Foo: +Foo : loop null; null; diff --git a/testsuite/tests/unparsing/paren_expr/inside_if/input.ada b/testsuite/tests/unparsing/paren_expr/inside_if/input.ada new file mode 100644 index 000000000..59ec50acd --- /dev/null +++ b/testsuite/tests/unparsing/paren_expr/inside_if/input.ada @@ -0,0 +1,10 @@ +if (Key = Last_Hang + or Key = Last_Crash + or Key = Last_Find + or Key = Slowest_Execution_MS + or Key = Execs_Done) + and Val = "0" +then + Data_Valid := False; + return Val; +end if; diff --git a/testsuite/tests/unparsing/paren_expr/inside_if/test.out b/testsuite/tests/unparsing/paren_expr/inside_if/test.out new file mode 100644 index 000000000..59ec50acd --- /dev/null +++ b/testsuite/tests/unparsing/paren_expr/inside_if/test.out @@ -0,0 +1,10 @@ +if (Key = Last_Hang + or Key = Last_Crash + or Key = Last_Find + or Key = Slowest_Execution_MS + or Key = Execs_Done) + and Val = "0" +then + Data_Valid := False; + return Val; +end if; diff --git a/testsuite/tests/unparsing/paren_expr/inside_if/test.yaml b/testsuite/tests/unparsing/paren_expr/inside_if/test.yaml new file mode 100644 index 000000000..bbb69ef12 --- /dev/null +++ b/testsuite/tests/unparsing/paren_expr/inside_if/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: if_stmt +descrition: | + Test that the expression inside a `ParenExpr` has a continuation line + indentation of 1. diff --git a/testsuite/tests/unparsing/paren_expr/input.ada b/testsuite/tests/unparsing/paren_expr/long/input.ada similarity index 100% rename from testsuite/tests/unparsing/paren_expr/input.ada rename to testsuite/tests/unparsing/paren_expr/long/input.ada diff --git a/testsuite/tests/unparsing/paren_expr/test.out b/testsuite/tests/unparsing/paren_expr/long/test.out similarity index 100% rename from testsuite/tests/unparsing/paren_expr/test.out rename to testsuite/tests/unparsing/paren_expr/long/test.out diff --git a/testsuite/tests/unparsing/paren_expr/test.yaml b/testsuite/tests/unparsing/paren_expr/long/test.yaml similarity index 100% rename from testsuite/tests/unparsing/paren_expr/test.yaml rename to testsuite/tests/unparsing/paren_expr/long/test.yaml diff --git a/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/input.ada b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/input.ada new file mode 100644 index 000000000..0a8049292 --- /dev/null +++ b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/input.ada @@ -0,0 +1 @@ +raise Some_Exception with "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA"; diff --git a/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.out b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.out new file mode 100644 index 000000000..9bdf9f09f --- /dev/null +++ b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.out @@ -0,0 +1,6 @@ +raise Some_Exception + with + "AAAAAAAAAAAAAAAAAAAAAAAA" + & "AAAAAAAAAAAAAAAAAAAAAAAA" + & "AAAAAAAAAAAAAAAAAAAAAAAA" + & "AAAAAAAAAAAAAAAAAAAAAAAA"; diff --git a/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.yaml b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.yaml new file mode 100644 index 000000000..54470ff0c --- /dev/null +++ b/testsuite/tests/unparsing/raise_stmt/long_error_message_concatenation/test.yaml @@ -0,0 +1,7 @@ +driver: unparser +rule: raise_stmt +description: | + This test checks the formatting of a `RaiseExpr` that has a long + `f_error_message` which consists of concatenations. + It is expected `f_error_message` to be continuation line indented relative to + `with`. diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/input.ada b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/input.ada new file mode 100644 index 000000000..d576d708b --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/input.ada @@ -0,0 +1,3 @@ +[for Value of Foo_Bar => Value]' + Reduce + (Foo_Bar_Bar_Bar_Bar_Bar_Bar_Bar, Bar_Foo_Foo_Foo_Foo_Foo_Foo_Foo_Foo_Foo) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.out b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.out new file mode 100644 index 000000000..d576d708b --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.out @@ -0,0 +1,3 @@ +[for Value of Foo_Bar => Value]' + Reduce + (Foo_Bar_Bar_Bar_Bar_Bar_Bar_Bar, Bar_Foo_Foo_Foo_Foo_Foo_Foo_Foo_Foo_Foo) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.yaml b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.yaml new file mode 100644 index 000000000..e51f51048 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_after_reduce/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: expr +description: | + This tests checks that a `ReduceAttributeRef` first tries to break after the + `Reduce` attribute and not the `f_args` field. diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/input.ada b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/input.ada new file mode 100644 index 000000000..ea1dcba68 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/input.ada @@ -0,0 +1,2 @@ +[for Value of Foo_Bar => Value]' + Reduce (Foo_Bar_Bar_Bar_Bar, Bar_Foo_Foo_Foo_Foo) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.out b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.out new file mode 100644 index 000000000..ea1dcba68 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.out @@ -0,0 +1,2 @@ +[for Value of Foo_Bar => Value]' + Reduce (Foo_Bar_Bar_Bar_Bar, Bar_Foo_Foo_Foo_Foo) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.yaml b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.yaml new file mode 100644 index 000000000..46defda16 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/break_before_reduce/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: expr +description: | + This tests checks that a `ReduceAttributeRef` is first broken before the + `Reduce` attribute. diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/long/input.ada b/testsuite/tests/unparsing/reduce_attribute_ref/long/input.ada new file mode 100644 index 000000000..ceb35faf3 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/long/input.ada @@ -0,0 +1,5 @@ +[for Value_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA of AAAAAAAAAAAAAAAAAAAAAA + => Value]' + Reduce + (Fooooooooooooooooooooooooooooooooo, + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/long/test.out b/testsuite/tests/unparsing/reduce_attribute_ref/long/test.out new file mode 100644 index 000000000..ceb35faf3 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/long/test.out @@ -0,0 +1,5 @@ +[for Value_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA of AAAAAAAAAAAAAAAAAAAAAA + => Value]' + Reduce + (Fooooooooooooooooooooooooooooooooo, + Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/long/test.yaml b/testsuite/tests/unparsing/reduce_attribute_ref/long/test.yaml new file mode 100644 index 000000000..ad6af4ae2 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/long/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: expr +description: | + This tests checks the indentation when all possible line breaks of a + `ReduceAttributeRef` are active. diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/short/input.ada b/testsuite/tests/unparsing/reduce_attribute_ref/short/input.ada new file mode 100644 index 000000000..3ad530a60 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/short/input.ada @@ -0,0 +1 @@ +[for Value of A => Value]'Reduce ("+", 0) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/short/test.out b/testsuite/tests/unparsing/reduce_attribute_ref/short/test.out new file mode 100644 index 000000000..3ad530a60 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/short/test.out @@ -0,0 +1 @@ +[for Value of A => Value]'Reduce ("+", 0) diff --git a/testsuite/tests/unparsing/reduce_attribute_ref/short/test.yaml b/testsuite/tests/unparsing/reduce_attribute_ref/short/test.yaml new file mode 100644 index 000000000..30ef62eb0 --- /dev/null +++ b/testsuite/tests/unparsing/reduce_attribute_ref/short/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: expr +description: | + Test that when a `ReduceAttributeRef` fits in a single line, it does not + break. diff --git a/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/input.ada b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/input.ada new file mode 100644 index 000000000..007668d33 --- /dev/null +++ b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/input.ada @@ -0,0 +1 @@ +return Fooooooooooooooooooooo / Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.out b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.out new file mode 100644 index 000000000..90088c417 --- /dev/null +++ b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.out @@ -0,0 +1,2 @@ +return + Fooooooooooooooooooooo / Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar; diff --git a/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.yaml b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.yaml new file mode 100644 index 000000000..5426a30de --- /dev/null +++ b/testsuite/tests/unparsing/return_stmt/long_breaking_return_expr/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: return_stmt +description: | + Test the `ReturnStmt` on the line length limit. + It is expected that tit breaks after the `return` keyword. diff --git a/testsuite/tests/unparsing/subtype_decl/long/input.ada b/testsuite/tests/unparsing/subtype_decl/long/input.ada new file mode 100644 index 000000000..40dac4f31 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/long/input.ada @@ -0,0 +1 @@ +subtype Foo_Bar_Bar_Foo is Foo_Bar_Bar_Bar_Bar_Bar.Bar_Foo_Foo_Foo_Foo_Foo_Foo_Foo; diff --git a/testsuite/tests/unparsing/subtype_decl/long/test.out b/testsuite/tests/unparsing/subtype_decl/long/test.out new file mode 100644 index 000000000..09baf28e1 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/long/test.out @@ -0,0 +1,2 @@ +subtype Foo_Bar_Bar_Foo is + Foo_Bar_Bar_Bar_Bar_Bar.Bar_Foo_Foo_Foo_Foo_Foo_Foo_Foo; diff --git a/testsuite/tests/unparsing/subtype_decl/long/test.yaml b/testsuite/tests/unparsing/subtype_decl/long/test.yaml new file mode 100644 index 000000000..2526b31b1 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/long/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subtype_decl +description: | + Test that a `SubtypeDecl` first breaks before the `f_subtype` diff --git a/testsuite/tests/unparsing/subtype_decl/short/input.ada b/testsuite/tests/unparsing/subtype_decl/short/input.ada new file mode 100644 index 000000000..1ed969285 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/short/input.ada @@ -0,0 +1 @@ +subtype Foo is Bar; diff --git a/testsuite/tests/unparsing/subtype_decl/short/test.out b/testsuite/tests/unparsing/subtype_decl/short/test.out new file mode 100644 index 000000000..1ed969285 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/short/test.out @@ -0,0 +1 @@ +subtype Foo is Bar; diff --git a/testsuite/tests/unparsing/subtype_decl/short/test.yaml b/testsuite/tests/unparsing/subtype_decl/short/test.yaml new file mode 100644 index 000000000..0fc4fbe16 --- /dev/null +++ b/testsuite/tests/unparsing/subtype_decl/short/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: subtype_decl +description: | + Test that no line breaks are added when the `SubtypeDecl` fits on one line. diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/long/input.ada b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/input.ada new file mode 100644 index 000000000..55a4f0e6c --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/input.ada @@ -0,0 +1 @@ +type Coloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooor is mod <>; diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.out b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.out new file mode 100644 index 000000000..d447a86ed --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.out @@ -0,0 +1,2 @@ +type Coloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooor is + mod <>; diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.yaml b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.yaml new file mode 100644 index 000000000..ef0dbc440 --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/long/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: type_decl +description: | + Test the line break before the `ModIntTypeDef`. diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/short/input.ada b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/input.ada new file mode 100644 index 000000000..2023bb79b --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/input.ada @@ -0,0 +1 @@ +type Day is mod <>; diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.out b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.out new file mode 100644 index 000000000..2023bb79b --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.out @@ -0,0 +1 @@ +type Day is mod <>; diff --git a/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.yaml b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.yaml new file mode 100644 index 000000000..c526c2b3f --- /dev/null +++ b/testsuite/tests/unparsing/type_def/mod_int_type_def/short/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: type_decl +description: | + Test the a short `ModIntTypeDef` does not break.