Natools

Diff
Login

Differences From Artifact [73197627eb]:

To Artifact [63945212c8]:


73
74
75
76
77
78
79

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







+







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



   -----------------------
   -- Inidividual Tests --
   -----------------------
696
697
698
699
700
701
702















































































703
704
705
706
707
708
709
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789







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







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


   procedure Tabulation_Width (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Width of tabulations");

      procedure Fill (P : in out Stream_Printer; Times : in Natural);

      X : constant Atom := To_Atom ("x");

      procedure Fill (P : in out Stream_Printer; Times : in Natural) is
      begin
         for I in 1 .. Times loop
            P.Append_Atom (X);
         end loop;
      end Fill;

      Tab : constant Character := Latin_1.HT;
      NL : constant Character := Latin_1.LF;
      Param : constant Parameters
        := (Width => 20,
            Newline_At => (others => (others => False)),
            Space_At =>
              (Atom_Data => (Opening => True, others => False),
               others => (others => False)),
            Tab_Stop => 5,
            Indentation => 3,
            Indent => Tabs_And_Spaces,
            Quoted => Single_Line,
            Token => Standard_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 : Stream_Printer (Output'Access);
      begin
         Output.Set_Expected (To_Atom                  --  1234-6789-1234-6789-
            ("(first-level x x x x" & NL               --  (first-level x x x x
           & "   x (second-level x" & NL               --  ...x (second-level x
           & Tab & " x x x x x x x" & NL               --  >----.x x x x x x x
           & Tab & " x x (third x x" & NL              --  >----.x x (third x x
           & Tab & "    x (fourth x" & NL              --  >----....x (fourth x
           & Tab & Tab & "  x x (x x" & NL             --  >---->----..x x (x x
           & Tab & Tab & Tab & "x)x x" & NL            --  >---->---->----x)x x
           & Tab & Tab & "  x))x x x" & NL             --  >---->----..x))x x x
           & Tab & " x))"));                           --  >----.x))

         P.Set_Parameters (Param);

         P.Open_List;
         P.Append_Atom (To_Atom ("first-level"));
         Fill (P, 5);
         P.Open_List;
         P.Append_Atom (To_Atom ("second-level"));
         Fill (P, 10);
         P.Open_List;
         P.Append_Atom (To_Atom ("third"));
         Fill (P, 3);
         P.Open_List;
         P.Append_Atom (To_Atom ("fourth"));
         Fill (P, 3);
         P.Open_List;
         Fill (P, 3);
         P.Close_List;
         Fill (P, 3);
         P.Close_List;
         P.Close_List;
         Fill (P, 4);
         P.Close_List;
         P.Close_List;

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


   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;