1 ------------------------------------------------------------------------------
4 -- Copyright (C) 2007 --
5 -- Pascal Obry - Olivier Ramonat --
7 -- This library is free software; you can redistribute it and/or modify --
8 -- it under the terms of the GNU General Public License as published by --
9 -- the Free Software Foundation; either version 2 of the License, or (at --
10 -- your option) any later version. --
12 -- This library is distributed in the hope that it will be useful, but --
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
15 -- General Public License for more details. --
17 -- You should have received a copy of the GNU General Public License --
18 -- along with this library; if not, write to the Free Software Foundation, --
19 -- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --
20 ------------------------------------------------------------------------------
22 with Ada
.Command_Line
;
25 with Ada
.Strings
.Unbounded
;
36 use Ada
.Strings
.Unbounded
;
45 ("<a href='http://morzhol.google.code.com'>Morzhol</a>") /= "Morzhol"
46 or else HTML_To_Text
("A <em>small</em> test") /= "A small test"
48 ("for <br /><hr /><br /> html_to_text") /= "for html_to_text"
50 Put_Line
("HTML_To_Text Error");
54 Create_Test_File
: declare
55 File_To_Create
: File_Type
;
58 if Directories
.Exists
("test/RCS") then
59 Directories
.Delete_Tree
("test/RCS");
62 if Directories
.Exists
("test/RCS_Test") then
63 Directories
.Delete_File
("test/RCS_Test");
66 Create
(File
=> File_To_Create
,
68 Name
=> "test/RCS_Test");
70 Put
(File_To_Create
, "test");
71 Close
(File_To_Create
);
74 if not Lock
(VCS_Engine
, "test/RCS_Test") then
77 if not Add
(VCS_Engine
, "test/RCS_Test", Author
=> "initial_author")
78 or else not Lock
(VCS_Engine
, "test/RCS_Test")
80 Put_Line
("Can not Lock RCS Test !");
85 Change_Test_File
: declare
86 File_To_Change
: File_Type
;
88 Open
(File
=> File_To_Change
,
90 Name
=> "test/RCS_Test");
92 Put
(File_To_Change
, "modification");
93 Close
(File_To_Change
);
97 (Engine
=> VCS_Engine
,
98 Filename
=> "test/RCS_Test",
99 Message
=> "first commit by test.adb",
102 Ada
.Text_IO
.Put_Line
("Commit failure");
107 File_Log
: constant Morzhol
.VC
.Log
:=
108 Get_Log
(VCS_Engine
, "test/RCS_Test");
109 Diff_Txt
: Unbounded_String
:=
110 +Diff
(VCS_Engine
, "test/RCS_Test",
111 -File_Log
(2).Revision
, -File_Log
(1).Revision
);
113 -- Remove CR for Windows compatibility
116 I
: constant Natural := Index
(Diff_Txt
, String'(1 => ASCII.CR));
118 exit Search_CR when I = 0;
119 Delete (Diff_Txt, I, I);
124 "==================================================================="
125 & ASCII.LF & "RCS file: test/RCS/RCS_Test,v"
126 & ASCII.LF & "retrieving revision 1.1"
127 & ASCII.LF & "retrieving revision 1.2"
128 & ASCII.LF & "diff -r1.1 -r1.2"
130 & ASCII.LF & "< test"
132 & ASCII.LF & "> modification"
133 or else -File_Log (1).Author /= "author"
134 or else -File_Log (2).Author /= "initial_author"
136 Put_Line ("Diff error !");
141 Put_Line ("OK. All tests passed !");
142 Set_Exit_Status (Success);
146 Put_Line (Exceptions.Exception_Information (E));
147 Set_Exit_Status (Failure);