THRIFT-5048 EnumUtils<T>.ToString() throws for elements not known to the receiving end [ci skip]
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/test/skip/skiptest_version1.dpr b/lib/delphi/test/skip/skiptest_version1.dpr
index c97e50b..f7cde2f 100644
--- a/lib/delphi/test/skip/skiptest_version1.dpr
+++ b/lib/delphi/test/skip/skiptest_version1.dpr
@@ -30,6 +30,7 @@
   Thrift.Transport in '..\..\src\Thrift.Transport.pas',
   Thrift.Protocol in '..\..\src\Thrift.Protocol.pas',
   Thrift.Protocol.JSON in '..\..\src\Thrift.Protocol.JSON.pas',
+  Thrift.Protocol.Compact in '..\..\src\Thrift.Protocol.Compact.pas',
   Thrift.Collections in '..\..\src\Thrift.Collections.pas',
   Thrift.Configuration in '..\..\src\Thrift.Configuration.pas',
   Thrift.Server in '..\..\src\Thrift.Server.pas',
@@ -47,6 +48,7 @@
 begin
   result := TPingImpl.Create;
   result.Version1  := Tskiptest_version_1Constants.SKIPTESTSERVICE_VERSION;
+  result.EnumTest  := TPingPongEnum.PingOne;
 end;
 
 
@@ -54,14 +56,16 @@
   TDummyServer = class( TInterfacedObject, TSkipTestService.Iface)
   protected
     // TSkipTestService.Iface
-    procedure PingPong(const ping: IPing);
+    function PingPong(const ping: IPing): IPing;
   end;
 
 
-procedure TDummyServer.PingPong(const ping: IPing);
+function TDummyServer.PingPong(const ping: IPing): IPing;
 // TSkipTestService.Iface
 begin
   Writeln('- performing request from version '+IntToStr(ping.Version1)+' client');
+  Writeln( ping.ToString);
+  result := CreatePing;
 end;
 
 
@@ -109,6 +113,7 @@
 
 procedure ReadResponse( protfact : IProtocolFactory; fname : string);
 var stm    : TFileStream;
+    ping   : IPing;
     proto  : IProtocol;
     client : TSkipTestService.TClient;   // we need access to send/recv_pingpong()
     cliRef : IUnknown;                   // holds the refcount
@@ -116,11 +121,11 @@
   Writeln('- reading response');
   stm := TFileStream.Create( fname+RESPONSE_EXT, fmOpenRead);
   try
-    // save request data
+    // load request data
     proto  := CreateProtocol( protfact, stm, TRUE);
     client := TSkipTestService.TClient.Create( proto, nil);
     cliRef := client as IUnknown;
-    client.recv_PingPong;
+    ping   := client.recv_PingPong;
 
   finally
     client := nil;  // not Free!
@@ -164,12 +169,14 @@
 procedure Test( protfact : IProtocolFactory; fname : string);
 begin
   // try to read an existing request
+  Writeln('Reading data file '+fname);
   if FileExists( fname + REQUEST_EXT) then begin
     ProcessFile( protfact, fname);
     ReadResponse( protfact, fname);
   end;
 
   // create a new request and try to process
+  Writeln('Writing data file '+fname);
   CreateRequest( protfact, fname);
   ProcessFile( protfact, fname);
   ReadResponse( protfact, fname);
@@ -177,8 +184,9 @@
 
 
 const
-  FILE_BINARY = 'pingpong.bin';
-  FILE_JSON   = 'pingpong.json';
+  FILE_BINARY  = 'pingpong.bin';
+  FILE_JSON    = 'pingpong.json';
+  FILE_COMPACT = 'pingpong.compact';
 begin
   try
     Writeln( 'Delphi SkipTest '+IntToStr(Tskiptest_version_1Constants.SKIPTESTSERVICE_VERSION)+' using '+Thrift.Version);
@@ -192,6 +200,10 @@
     Test( TJSONProtocolImpl.TFactory.Create,   FILE_JSON);
 
     Writeln;
+    Writeln('Compact protocol');
+    Test( TCompactProtocolImpl.TFactory.Create, FILE_COMPACT);
+
+    Writeln;
     Writeln('Test completed without errors.');
     Writeln;
     Write('Press ENTER to close ...');  Readln;