ソースを参照

* Webassembly also has reversed clean - most likely 32/64 bits issue, not delphi/FPC issue

Michaël Van Canneyt 2 年 前
コミット
e4ded6e277
1 ファイル変更16 行追加4 行削除
  1. 16 4
      packages/rtl-generics/tests/tests.generics.dictionary.pas

+ 16 - 4
packages/rtl-generics/tests/tests.generics.dictionary.pas

@@ -175,7 +175,7 @@ end;
 
 procedure TTestSimpleDictionary.DoKeyNotify(ASender: TObject; const AItem: Integer; AAction: TCollectionNotification);
 begin
-  Writeln(FnotifyMessage+' Notification',FCurrentKeyNotify);
+  Writeln(FnotifyMessage+' Notification ',FCurrentKeyNotify);
   AssertSame(FnotifyMessage+' Correct sender', FDict,aSender);
   if (FCurrentKeyNotify>=Length(FExpectKeys)) then
     Fail(FnotifyMessage+' Too many notificiations');
@@ -185,7 +185,7 @@ end;
 
 procedure TTestSimpleDictionary.DoValueNotify(ASender: TObject; const AItem: String; AAction: TCollectionNotification);
 begin
-  Writeln(FnotifyMessage+' value Notification',FCurrentValueNotify);
+  Writeln(FnotifyMessage+' value Notification ',FCurrentValueNotify);
   AssertSame(FnotifyMessage+' value Correct sender', FDict,aSender);
   if (FCurrentValueNotify>=Length(FExpectValues)) then
     Fail(FnotifyMessage+' Too many value notificiations');
@@ -449,12 +449,24 @@ begin
   DoneExpectKeys;
 end;
 
+Const
+{$IFDEF FPC}
+  {$IFNDEF CPUWASM}
+    ReverseDeleteNotification = True;
+  {$ElSE}
+    ReverseDeleteNotification = False;
+  {$ENDIF}
+{$ELSE}
+   ReverseDeleteNotification = False;
+{$ENDIF}
+
 procedure TTestSimpleDictionary.TestNotificationDelete;
 
+
 begin
   DoAdd(3);
   Dict.OnKeyNotify:=@DoKeyNotify;
-  SetExpectKeys('Clear',[1,2,3],[cnRemoved,cnRemoved,cnRemoved],{$IFDEF FPC}true{$ELSE}False{$endif});
+  SetExpectKeys('Clear',[1,2,3],[cnRemoved,cnRemoved,cnRemoved],ReverseDeleteNotification);
   Dict.Clear;
   DoneExpectKeys;
 end;
@@ -471,7 +483,7 @@ procedure TTestSimpleDictionary.TestValueNotificationDelete;
 begin
   DoAdd(3);
   Dict.OnValueNotify:=@DoValueNotify;
-  SetExpectValues('Clear',['1','2','3'],[cnRemoved,cnRemoved,cnRemoved],{$IFDEF FPC}true{$ELSE}False{$endif});
+  SetExpectValues('Clear',['1','2','3'],[cnRemoved,cnRemoved,cnRemoved],ReverseDeleteNotification);
   Dict.Clear;
   DoneExpectValues;
 end;