Natools

Diff
Login

Differences From Artifact [95cc049bee]:

To Artifact [facab2d13a]:


112
113
114
115
116
117
118

119
120
121
122
123
124
125
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
      Newline_Formats (Report);
      Token_Separation (Report);

   end All_Tests;



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







>







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
      Atom_Encodings (Report);
      Separators (Report);
      Atom_Width (Report);
      Quoted_String_Escapes (Report);
      Indentation (Report);
      Newline_Formats (Report);
      Token_Separation (Report);
      Parameter_Mutators (Report);
   end All_Tests;



   -----------------------
   -- Inidividual Tests --
   -----------------------
391
392
393
394
395
396
397




























































398
399
400
401
402
403
404
         Print (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Newline_Formats;






























































   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







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







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
         Print (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Newline_Formats;


   procedure Parameter_Mutators (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Parameter mutators");
      Initial : constant Parameters
        := (Width => 0,
            Newline_At => (others => (others => False)),
            Space_At => (others => (others => False)),
            Tab_Stop => 8,
            Indentation => 0,
            Indent => Spaces,
            Quoted => No_Quoted,
            Token => No_Token,
            Hex_Casing => Encodings.Upper,
            Quoted_Escape => Octal_Escape,
            Char_Encoding => ASCII,
            Fallback => Verbatim,
            Newline => LF);
      Final : constant Parameters
        := (Width => 79,
            Newline_At => (others => (others => True)),
            Space_At => (others => (others => True)),
            Tab_Stop => 4,
            Indentation => 1,
            Indent => Tabs,
            Quoted => When_Shorter,
            Token => Standard_Token,
            Hex_Casing => Encodings.Lower,
            Quoted_Escape => Hex_Escape,
            Char_Encoding => UTF_8,
            Fallback => Hexadecimal,
            Newline => CR_LF);
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         Pr : Printer (Output'Access);
      begin
         Pr.Set_Parameters (Initial);

         Pr.Set_Width (Final.Width);
         Pr.Set_Newline_At (Final.Newline_At);
         Pr.Set_Space_At (Final.Space_At);
         Pr.Set_Tab_Stop (Final.Tab_Stop);
         Pr.Set_Indentation (Final.Indentation);
         Pr.Set_Indent (Final.Indent);
         Pr.Set_Quoted (Final.Quoted);
         Pr.Set_Token (Final.Token);
         Pr.Set_Hex_Casing (Final.Hex_Casing);
         Pr.Set_Quoted_Escape (Final.Quoted_Escape);
         Pr.Set_Char_Encoding (Final.Char_Encoding);
         Pr.Set_Fallback (Final.Fallback);
         Pr.Set_Newline (Final.Newline);

         if Pr.Get_Parameters /= Final then
            Test.Fail;
         end if;
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Parameter_Mutators;


   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