Michaël Van Canneyt 9 months ago
parent
commit
d486463bc1
1 changed files with 12 additions and 0 deletions
  1. 12 0
      packages/rtl-objpas/tests/tests.rtti.value.pas

+ 12 - 0
packages/rtl-objpas/tests/tests.rtti.value.pas

@@ -52,6 +52,7 @@ Type
     procedure TestMakeGenericWideChar;
 
     procedure TestFromOrdinal;
+    Procedure TestTryCastUnicodeString;
   end;
 
   { TTestValueArray }
@@ -1533,6 +1534,17 @@ begin
   CheckException({$ifdef fpc}@{$endif}MakeFromOrdinalString, EInvalidCast);
 end;
 
+procedure TTestValueSimple.TestTryCastUnicodeString;
+
+var
+  S: string;
+  V, V2: TValue;
+begin
+  S := 'str';
+  V := S;
+  CheckTrue(V.TryCast(TypeInfo(UnicodeString), V2),'Cast OK');
+end;
+
 { TTestValueArray }