testjson2code.lpr 927 B

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