Natools

Check-in [b48757a3eb]
Login
Overview
Comment:s_expressions-printers-pretty-tests: new test for indentation mechanisms
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b48757a3eba373e1c3d42e94612e263e945859e7
User & Date: nat on 2014-02-02 12:58:35
Other Links: manifest | tags
Context
2014-02-03
21:05
s_expressions-printers-pretty: add missing width handling in Open_List and Close_List check-in: 7037b039d6 user: nat tags: trunk
2014-02-02
12:58
s_expressions-printers-pretty-tests: new test for indentation mechanisms check-in: b48757a3eb user: nat tags: trunk
2014-02-01
13:27
s_expressions-printers-pretty: fix width overflow in quoted string escapes check-in: da55fecd97 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-printers-pretty-tests.adb from [a30546dd04] to [79759db515].

109
110
111
112
113
114
115

116
117
118
119
120
121
122
   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Basic_Printing (Report);
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);

   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------







>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Basic_Printing (Report);
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------
237
238
239
240
241
242
243





















































244
245
246
247
248
249
250

         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Basic_Printing;























































   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Escapes in quoted string atoms");
      Source : constant Atom (0 .. 123) := To_Atom
        ("Special: "  --  indices 0 .. 17
         & Latin_1.BS & Latin_1.HT & Latin_1.LF
         & Latin_1.VT & Latin_1.FF & Latin_1.CR







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Basic_Printing;


   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)),
            Tab_Stop => 8,
            Indentation => 3,
            Indent => Tabs_And_Spaces,
            Quoted => Single_Line,
            Token => Standard_Token,
            Hex_Casing => Encodings.Upper,
            Quoted_Escape => Hex_Escape,
            Char_Encoding => ASCII,
            Fallback => Verbatim,
            Newline => LF);
   begin
      Parse_Print_Test (Test, Param, To_Atom
        ("(first-level(" & Latin_1.LF
         & "      second-level" & Latin_1.LF
         & "      (third" & Latin_1.LF
         & Latin_1.HT & " level" & Latin_1.LF
         & Latin_1.HT & " ""Q#""))" & Latin_1.LF
         & "   end)"));

      Param.Indent := Spaces;
      Param.Token := Extended_Token;

      Parse_Print_Test (Test, Param, To_Atom
        ("(first-level(" & Latin_1.LF
         & "      second-level" & Latin_1.LF
         & "      (third" & Latin_1.LF
         & "         level" & Latin_1.LF
         & "         ""Q)""))" & Latin_1.LF
         & "   end)"));

      Param.Indent := Tabs;
      Param.Indentation := 1;
      Param.Tab_Stop := 5;

      Parse_Print_Test (Test, Param, To_Atom
        ("(first-level(" & Latin_1.LF
         & Latin_1.HT & Latin_1.HT & "second-level" & Latin_1.LF
         & Latin_1.HT & Latin_1.HT & "(third" & Latin_1.LF
         & Latin_1.HT & Latin_1.HT & Latin_1.HT & "level" & Latin_1.LF
         & Latin_1.HT & Latin_1.HT & Latin_1.HT & "2:Q(" & Latin_1.LF
         & Latin_1.HT & Latin_1.HT & "))end)"));

   exception
      when Error : others => Test.Report_Exception (Error);
   end Indentation;


   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Escapes in quoted string atoms");
      Source : constant Atom (0 .. 123) := To_Atom
        ("Special: "  --  indices 0 .. 17
         & Latin_1.BS & Latin_1.HT & Latin_1.LF
         & Latin_1.VT & Latin_1.FF & Latin_1.CR

Modified tests/natools-s_expressions-printers-pretty-tests.ads from [eaa3a2fef7] to [d09d9ce64c].

27
28
29
30
31
32
33

34
35
36
37
   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 Quoted_String_Escapes (Report : in out NT.Reporter'Class);
   procedure Separators (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Printers.Pretty.Tests;







>




27
28
29
30
31
32
33
34
35
36
37
38
   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 Indentation (Report : in out NT.Reporter'Class);
   procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class);
   procedure Separators (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Printers.Pretty.Tests;