Index: tests/natools-s_expressions-printers-pretty-tests.adb ================================================================== --- tests/natools-s_expressions-printers-pretty-tests.adb +++ tests/natools-s_expressions-printers-pretty-tests.adb @@ -74,10 +74,11 @@ Quoted_String_Escapes (Report); Indentation (Report); Newline_Formats (Report); Token_Separation (Report); Parameter_Mutators (Report); + Expression_Width (Report); end All_Tests; ----------------------- @@ -202,10 +203,67 @@ end; exception when Error : others => Test.Report_Exception (Error); end Basic_Printing; + + procedure Expression_Width (Report : in out NT.Reporter'Class) is + Test : NT.Test := Report.Item ("S-expression width"); + Param : constant Parameters + := (Width => 6, + Newline_At => (others => (others => True)), + Space_At => (others => (others => False)), + Tab_Stop => 8, + Indentation => 0, + Indent => Tabs_And_Spaces, + Quoted => Single_Line, + Token => No_Token, + Hex_Casing => Encodings.Upper, + Quoted_Escape => Hex_Escape, + Char_Encoding => UTF_8, + Fallback => Verbatim, + Newline => LF); + begin + declare + Output : aliased Test_Tools.Memory_Stream; + P, Q : Stream_Printer (Output'Access); + Template : constant Atom (1 .. 6) := To_Atom ("é-123"); + begin + Output.Set_Expected (To_Atom + ("""\xC3""" & Latin_1.LF + & """é""" & Latin_1.LF + & """é-""" & Latin_1.LF + & """é-1""" & Latin_1.LF + & """é-12""" & Latin_1.LF + & "6:é-123" & Latin_1.LF + & '"' & Character'Val (16#C3#) & '"' & Latin_1.LF + & """é""" & Latin_1.LF + & """é-""" & Latin_1.LF + & """é-1""" & Latin_1.LF + & "5:é-12" & Latin_1.LF + & "6:é-123")); + + P.Set_Parameters (Param); + Q.Set_Parameters (Param); + Q.Set_Char_Encoding (Latin); + + for I in Template'Range loop + P.Append_Atom (Template (Template'First .. I)); + end loop; + + P.Newline; + + for I in Template'Range loop + Q.Append_Atom (Template (Template'First .. I)); + end loop; + + Output.Check_Stream (Test); + end; + exception + when Error : others => Test.Report_Exception (Error); + end Expression_Width; + procedure Indentation (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Indentation"); Param : Parameters := (Width => 16, Index: tests/natools-s_expressions-printers-pretty-tests.ads ================================================================== --- tests/natools-s_expressions-printers-pretty-tests.ads +++ tests/natools-s_expressions-printers-pretty-tests.ads @@ -29,13 +29,14 @@ procedure All_Tests (Report : in out NT.Reporter'Class); procedure Atom_Encodings (Report : in out NT.Reporter'Class); procedure Atom_Width (Report : in out NT.Reporter'Class); procedure Basic_Printing (Report : in out NT.Reporter'Class); + procedure Expression_Width (Report : in out NT.Reporter'Class); procedure Indentation (Report : in out NT.Reporter'Class); procedure Newline_Formats (Report : in out NT.Reporter'Class); procedure Parameter_Mutators (Report : in out NT.Reporter'Class); procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class); procedure Separators (Report : in out NT.Reporter'Class); procedure Token_Separation (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Printers.Pretty.Tests;