Natools

Check-in [2805404e82]
Login
Overview
Comment:s_expressions-printers-pretty-tests: add a test for expression width computations
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2805404e8214fbdc696f913e4a6de7e3e6f24d34
User & Date: nat on 2014-07-23 20:16:02
Other Links: manifest | tags
Context
2014-07-24
18:59
s_expressions-printers-pretty: fix Fit_In_Line width test check-in: fc581ebd8d user: nat tags: trunk
2014-07-23
20:16
s_expressions-printers-pretty-tests: add a test for expression width computations check-in: 2805404e82 user: nat tags: trunk
2014-07-22
18:40
s_expressions-lockable-tests: deepen the test on unwinding, to double-check the new Generic_Caches unwinding check-in: 49fd23378a user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-printers-pretty-tests.adb from [ec7ce81f68] to [73197627eb].

72
73
74
75
76
77
78

79
80
81
82
83
84
85
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86







+







      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
      Newline_Formats (Report);
      Token_Separation (Report);
      Parameter_Mutators (Report);
      Expression_Width (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------
200
201
202
203
204
205
206

























































207
208
209
210
211
212
213
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








         Output.Check_Stream (Test);
      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,
            Newline_At => (others => (others => False)),
            Space_At => (others => (others => False)),

Modified tests/natools-s_expressions-printers-pretty-tests.ads from [7a44a4daac] to [181e2b120b].

27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42







+








   package NT renames Natools.Tests;

   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;