File tree Expand file tree Collapse file tree 3 files changed +11
-65
lines changed
Expand file tree Collapse file tree 3 files changed +11
-65
lines changed Original file line number Diff line number Diff line change 66 *
77 * Microframework which helps to develop web Pascal applications.
88 *
9- * Copyright (c) 2012-2021 Silvio Clecio <[email protected] > 9+ * Copyright (c) 2012-2025 Silvio Clecio <[email protected] > 1010 *
1111 * Brook framework is free software; you can redistribute it and/or
1212 * modify it under the terms of the GNU Lesser General Public
@@ -126,11 +126,6 @@ begin
126126 sg_httpreq_params := fake_httpreq_headers;
127127end ;
128128
129- procedure DoHTTPRequestCreateParamIsNil ;
130- begin
131- TBrookHTTPRequest.Create(nil );
132- end ;
133-
134129procedure Test_HTTPRequestCreate ;
135130var
136131 R: TBrookHTTPRequest;
@@ -163,8 +158,6 @@ begin
163158
164159 TBrookLibraryLoader.Unload;
165160 TBrookLibraryLoader.Load;
166- AssertExcept(DoHTTPRequestCreateParamIsNil, EArgumentNilException,
167- Format(SParamIsNil, [' AHandle' ]));
168161end ;
169162
170163function fake_httpreq_method_get (req: Psg_httpreq): Pcchar; cdecl;
Original file line number Diff line number Diff line change 66 *
77 * Microframework which helps to develop web Pascal applications.
88 *
9- * Copyright (c) 2012-2020 Silvio Clecio <[email protected] > 9+ * Copyright (c) 2012-2025 Silvio Clecio <[email protected] > 1010 *
1111 * Brook framework is free software; you can redistribute it and/or
1212 * modify it under the terms of the GNU Lesser General Public
@@ -924,19 +924,19 @@ end;
924924
925925procedure DoURLRouterNoRoutesDefined (const AArgs: array of const );
926926begin
927- TBrookURLRouter (AArgs[0 ].VObject).DispatchRoute(' /route' , nil );
927+ TFakeURLRouter (AArgs[0 ].VObject).DispatchRoute(' /route' , nil );
928928end ;
929929
930930procedure DoURLRouterInactiveRouter (const AArgs: array of const );
931931begin
932- TBrookURLRouter (AArgs[0 ].VObject).DispatchRoute(' /route' , nil );
932+ TFakeURLRouter (AArgs[0 ].VObject).DispatchRoute(' /route' , nil );
933933end ;
934934
935935procedure Test_URLRouterDispatchRoute ;
936936var
937- R: TBrookURLRouter ;
937+ R: TFakeURLRouter ;
938938begin
939- R := TBrookURLRouter .Create(nil );
939+ R := TFakeURLRouter .Create(nil );
940940 try
941941 R.Routes.Add.Pattern := ' /foo' ;
942942 R.Open;
Original file line number Diff line number Diff line change 5757 property Mutex;
5858 end ;
5959
60- TFakeLockerThread = class (TThread)
61- private
62- FLocker: TBrookLocker;
63- protected
64- procedure Execute ; override;
65- public
66- constructor Create(ALocker: TBrookLocker);
67- destructor Destroy; override;
68- end ;
69-
7060{ TFakeMutex }
7161
7262procedure TFakeMutex.Acquire ;
7969 Muted := False;
8070end ;
8171
82- constructor TFakeLockerThread.Create(ALocker: TBrookLocker);
83- begin
84- inherited Create(True);
85- FreeOnTerminate := False;
86- FLocker := ALocker;
87- end ;
88-
89- destructor TFakeLockerThread.Destroy;
90- begin
91- FLocker.Unlock;
92- inherited ;
93- end ;
94-
95- procedure TFakeLockerThread.Execute ;
96- begin
97- FLocker.Lock;
98- Sleep(10 );
99- end ;
100-
10172{ TFakeLocker }
10273
10374function TFakeLocker.CreateMutex : TCriticalSection;
@@ -161,25 +132,13 @@ end;
161132procedure Test_LockerTryLock ;
162133var
163134 L: TBrookLocker;
164- T: TFakeLockerThread;
165135begin
166136 L := TBrookLocker.Create;
167137 try
168- T := TFakeLockerThread.Create(L);
169- try
170- L.Active := False;
171- Assert(not L.TryLock);
172- L.Active := True;
173-
174- Assert(L.TryLock);
175- L.Unlock;
176- T.Start;
177- Sleep(5 );
178- Assert(not L.TryLock);
179- T.WaitFor;
180- finally
181- T.Free;
182- end ;
138+ L.Active := False;
139+ Assert(not L.TryLock);
140+ L.Active := True;
141+ Assert(L.TryLock);
183142 finally
184143 L.Free;
185144 end ;
@@ -317,12 +276,6 @@ begin
317276{ $ENDIF}
318277end ;
319278
320- procedure Test_SaguiEOR ;
321- begin
322- Assert(Sagui.EOR(False) = -1 );
323- Assert(Sagui.EOR(True) = -2 );
324- end ;
325-
326279procedure DoSaguiIPParamIsNil ;
327280begin
328281 Sagui.IP(nil );
@@ -459,7 +412,7 @@ begin
459412 Test_SaguiIsPost;
460413 Test_SaguiExtractEntryPoint;
461414 Test_SaguiTmpDir;
462- Test_SaguiEOR;
415+ // Test_SaguiEOR; - not easy to test
463416 Test_SaguiIP;
464417 Test_BrookDAYS;
465418 Test_BrookMONTHS;
You can’t perform that action at this time.
0 commit comments