Skip to content

Commit 9189a84

Browse files
feature: add test for '/announce' missing
The add trackers file will be verified for the posible missing '/announce' Add some missing CheckEquals(0, FExitCode) in some test.
1 parent a9c5ad6 commit 9189a84

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

source/test/test_start_up_parameter.pas

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ TTestStartUpParameter = class(TTestCase)
7070
procedure TearDown; override;
7171
published
7272
procedure Test_Create_Empty_DHT_torrent;
73+
procedure Test_Tracker_UserInput_Without_Announce_Exit_Code;
7374
procedure Test_Create_Simple_Filled_torrent;
7475
procedure Test_Create_Filled_And_Empty_Torrent_All_Mode;
7576

@@ -297,14 +298,51 @@ procedure TTestStartUpParameter.Test_Paramater_Ux(TrackerListOrder: TTrackerList
297298
end;
298299

299300
procedure TTestStartUpParameter.Test_Create_Empty_DHT_torrent;
301+
var
302+
TrackerListOrder: TTrackerListOrder;
300303
begin
301-
CreateEmptyTorrent(tloInsertNewBeforeAndKeepNewIntact);
302-
TestEmptyTorrentResult;
304+
//Test if all the tracker update mode is working
305+
for TrackerListOrder in TTrackerListOrder do
306+
begin
307+
CreateEmptyTorrent(TrackerListOrder);
308+
TestEmptyTorrentResult;
309+
//check the exit code
310+
CheckEquals(0, FExitCode);
311+
end;
312+
end;
313+
314+
procedure TTestStartUpParameter.Test_Tracker_UserInput_Without_Announce_Exit_Code;
315+
var
316+
TrackerListOrder: TTrackerListOrder;
317+
begin
318+
//Test if all the tracker update mode is working
319+
for TrackerListOrder in TTrackerListOrder do
320+
begin
321+
322+
//add a wrong tracker without /announce
323+
FVerifyTrackerResult.TrackerAdded.Clear;
324+
FVerifyTrackerResult.TrackerAdded.Add('udp://test.com');
325+
326+
FVerifyTrackerResult.TrackerAdded.SaveToFile(FFullPathToEndUser +
327+
FILE_NAME_ADD_TRACKERS);
328+
329+
//Generate the command line parameter
330+
TestParameter(TrackerListOrder);
331+
332+
//call the tracker editor exe file
333+
CallExecutableFile;
334+
335+
//check the exit code. Must be an error
336+
CheckNotEquals(0, FExitCode);
337+
end;
303338
end;
304339

305340
procedure TTestStartUpParameter.Test_Create_Simple_Filled_torrent;
306341
begin
307342
CreateFilledTorrent(tloInsertNewBeforeAndKeepNewIntact);
343+
344+
//check the exit code
345+
CheckEquals(0, FExitCode);
308346
end;
309347

310348
procedure TTestStartUpParameter.Test_Create_Filled_And_Empty_Torrent_All_Mode;
@@ -324,8 +362,14 @@ procedure TTestStartUpParameter.Test_Create_Filled_And_Empty_Torrent_All_Mode;
324362
continue;
325363

326364
CreateEmptyTorrent(TrackerListOrder);
365+
//check the exit code
366+
CheckEquals(0, FExitCode);
367+
327368
TestEmptyTorrentResult;
369+
328370
CreateFilledTorrent(TrackerListOrder);
371+
//check the exit code
372+
CheckEquals(0, FExitCode);
329373
end;
330374
end;
331375

0 commit comments

Comments
 (0)