cProtoBufProtoParserSelfTest.pas 654 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. unit cProtoBufProtoParserSelfTest;
  2. interface
  3. procedure SelfTest;
  4. implementation
  5. uses
  6. cProtoBufProtoNodes,
  7. cProtoBufProtoParser;
  8. const
  9. CRLF = #$D#$A;
  10. ProtoText1 =
  11. 'message test { ' +
  12. ' required int32 field1 = 1; ' +
  13. '} ';
  14. ProtoText1_ProtoString =
  15. 'message test {' + CRLF +
  16. 'required int32 field1 = 1;' +
  17. '}' + CRLF;
  18. procedure SelfTest;
  19. var
  20. P : TpbProtoParser;
  21. A : TpbProtoPackage;
  22. begin
  23. P := TpbProtoParser.Create;
  24. P.SetTextStr(ProtoText1);
  25. A := P.Parse(GetDefaultProtoNodeFactory);
  26. Assert(Assigned(A));
  27. Assert(A.GetAsProtoString = ProtoText1_ProtoString);
  28. P.Free;
  29. end;
  30. end.