فهرست منبع

* Added test for r12771

git-svn-id: trunk@12772 -
joost 16 سال پیش
والد
کامیت
8d5463bfae
2فایلهای تغییر یافته به همراه35 افزوده شده و 0 حذف شده
  1. 1 0
      .gitattributes
  2. 34 0
      tests/test/packages/fcl-db/tdb6.pp

+ 1 - 0
.gitattributes

@@ -7696,6 +7696,7 @@ tests/test/packages/fcl-db/tdb2.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb3.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb4.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb5.pp svneol=native#text/plain
+tests/test/packages/fcl-db/tdb6.pp svneol=native#text/plain
 tests/test/packages/fcl-db/toolsunit.pas svneol=native#text/plain
 tests/test/packages/fcl-registry/tregistry1.pp svneol=native#text/plain
 tests/test/packages/fcl-xml/thtmlwriter.pp svneol=native#text/plain

+ 34 - 0
tests/test/packages/fcl-db/tdb6.pp

@@ -0,0 +1,34 @@
+program bugVarNullToString;
+
+{$Mode ObjFpc}
+{$H+}
+
+uses
+  Variants, Db, SysUtils;
+  
+var 
+  V: Variant;
+  S: String;
+  List: TLookupList;  
+begin
+  List := TLookupList.Create;
+  List.Add(1, 'X');
+  List.Add(2, 'Y');
+  
+  V := List.ValueOfKey(1);
+  S := VarToStr(V);
+  WriteLn(Format('Key: %d Value: "%s"', [1, S]));
+  if s<>'X' then Halt(1); 
+
+  V := List.ValueOfKey(2);
+  S := VarToStr(V);
+  WriteLn(Format('Key: %d Value: "%s"', [2, S]));
+  if s<>'Y' then Halt(1); 
+  
+  V := List.ValueOfKey(3);
+  S := VarToStr(V);
+  WriteLn(Format('Key: %d Value: "%s"', [3, S]));
+  if s<>'' then Halt(1); 
+
+  List.Free;
+end.