Browse Source

* Fixed windows-only test, added linux test

git-svn-id: trunk@17176 -
michael 14 years ago
parent
commit
8aca294896
1 changed files with 39 additions and 4 deletions
  1. 39 4
      packages/fcl-registry/tests/testbasics.pp

+ 39 - 4
packages/fcl-registry/tests/testbasics.pp

@@ -19,6 +19,7 @@ type
   protected
   protected
   published
   published
     procedure TestSimpleWinRegistry;
     procedure TestSimpleWinRegistry;
+    procedure TestDoubleWrite;
   end;
   end;
 
 
 implementation
 implementation
@@ -37,15 +38,49 @@ begin
 
 
   // use a hopefully non existing key
   // use a hopefully non existing key
   AssertFalse(Registry.KeyExists('FPC1234'));
   AssertFalse(Registry.KeyExists('FPC1234'));
-
+{$ifdef windows}
   AssertTrue(Registry.KeyExists('SOFTWARE'));
   AssertTrue(Registry.KeyExists('SOFTWARE'));
-
-  // Registry.OpenKey('FPC', False);
-  // Result:=Registry.ReadString('VALUE1');
+{$endif}  
 
 
   Registry.Free;
   Registry.Free;
 end;
 end;
 
 
+procedure TTestBasics.TestDoubleWrite;
+
+{$ifndef windows}
+Var
+  FN : String;
+{$endif}
+
+begin
+{$ifndef windows}
+  FN:=includetrailingpathdelimiter(GetAppConfigDir(False))+'reg.xml';
+  if FileExists(FN) then
+    AssertTrue(DeleteFile(FN));
+{$endif}
+  with TRegistry.Create do
+    try
+      OpenKey('test', true);
+      WriteString('LAYOUT', '');
+      CloseKey;
+    finally
+      Free;
+    end;
+  with TRegistry.Create do
+    try
+      OpenKey('test', true);
+      WriteString('LAYOUT', '');
+      CloseKey;
+    finally
+      Free;
+    end;
+{$ifndef windows}
+  FN:=includetrailingpathdelimiter(GetAppConfigDir(False))+'reg.xml';
+  if FileExists(FN) then
+    AssertTrue(DeleteFile(FN));
+{$endif}
+end;
+
 initialization
 initialization
   RegisterTest(TTestBasics);
   RegisterTest(TTestBasics);
 end.
 end.