testjson2code.lpr 948 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. program testjson2code;
  2. {$mode objfpc}{$H+}
  3. uses
  4. Classes, consoletestrunner, tcjsontocode, fpjsontopas;
  5. type
  6. { TLazTestRunner }
  7. { TMyTestRunner }
  8. TMyTestRunner = class(TTestRunner)
  9. protected
  10. function GetShortOpts: string; override;
  11. procedure AppendLongOpts; override;
  12. procedure DoRun; override;
  13. end;
  14. var
  15. Application: TMyTestRunner;
  16. { TMyTestRunner }
  17. function TMyTestRunner.GetShortOpts: string;
  18. begin
  19. Result:=inherited GetShortOpts;
  20. Result:=Result+'t:';
  21. end;
  22. procedure TMyTestRunner.AppendLongOpts;
  23. begin
  24. inherited AppendLongOpts;
  25. LongOpts.Add('testunitdir:');
  26. end;
  27. procedure TMyTestRunner.DoRun;
  28. begin
  29. TestUnitDir:=GetOptionValue('t','testunitdir');
  30. inherited DoRun;
  31. end;
  32. begin
  33. DefaultFormat:=fPlain;
  34. DefaultRunAllTests:=True;
  35. Application := TMyTestRunner.Create(nil);
  36. Application.Initialize;
  37. Application.Title := 'FPCUnit Console test runner';
  38. Application.Run;
  39. Application.Free;
  40. end.