Natools

Check-in [a450c7e1d4]
Login
Overview
Comment:s_expressions-printers-pretty-tests: new test for correctness of token encoding end markers
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a450c7e1d42a46957079fb90eb2d6075b3b645ce
User & Date: nat on 2014-02-07 21:50:04
Other Links: manifest | tags
Context
2014-02-08
17:17
s_expressions-printers-pretty-tests: new test for parameter mutators (this makes the test suite cover all the reachable code) check-in: 4a8ff2de3d user: nat tags: trunk
2014-02-07
21:50
s_expressions-printers-pretty-tests: new test for correctness of token encoding end markers check-in: a450c7e1d4 user: nat tags: trunk
2014-02-06
22:20
s_expressions-printers-pretty: fix quoted encoding size estimation on inserted newlines check-in: 528e853e08 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-printers-pretty-tests.adb from [748332722d] to [95cc049bee].

111
112
113
114
115
116
117

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

   end All_Tests;



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







>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
      Basic_Printing (Report);
      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 --
   -----------------------
617
618
619
620
621
622
623


















































624
         Test_Exp (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Separators;



















































end Natools.S_Expressions.Printers.Pretty.Tests;







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

618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
         Test_Exp (Pr);
         Check_Stream (Test, Output);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Separators;


   procedure Token_Separation (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Token separation");
      Token : constant Atom := To_Atom ("token");
   begin
      declare
         Output : aliased Test_Tools.Memory_Stream;
         Pr : Printer (Output'Access);
      begin
         Output.Set_Expected (To_Atom
           ("(begin(token ""quoted\n""token token #4865780A#token "
            & "|QmFzZS02NAo=|token)end)"));
         Pr.Set_Parameters
          ((Width => 0,
            Newline_At => (others => (others => False)),
            Space_At => (others => (others => False)),
            Tab_Stop => 8,
            Indentation => 0,
            Indent => Spaces,
            Quoted => When_Shorter,
            Token => Standard_Token,
            Hex_Casing => Encodings.Upper,
            Quoted_Escape => Hex_Escape,
            Char_Encoding => ASCII,
            Fallback => Hexadecimal,
            Newline => LF));

         Pr.Open_List;
         Pr.Append_Atom (To_Atom ("begin"));
         Pr.Open_List;
         Pr.Append_Atom (Token);
         Pr.Append_Atom (To_Atom ("quoted" & Latin_1.LF));
         Pr.Append_Atom (Token);
         Pr.Append_Atom (Token);
         Pr.Set_Quoted (No_Quoted);
         Pr.Append_Atom (To_Atom ("Hex" & Latin_1.LF));
         Pr.Append_Atom (Token);
         Pr.Set_Fallback (Base64);
         Pr.Append_Atom (To_Atom ("Base-64" & Latin_1.LF));
         Pr.Append_Atom (Token);
         Pr.Close_List;
         Pr.Append_Atom (To_Atom ("end"));
         Pr.Close_List;

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

end Natools.S_Expressions.Printers.Pretty.Tests;

Modified tests/natools-s_expressions-printers-pretty-tests.ads from [0ac2dd473a] to [47d92373a2].

31
32
33
34
35
36
37

38
39
   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 Newline_Formats (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;







>


31
32
33
34
35
36
37
38
39
40
   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 Newline_Formats (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;