testschema.lpr 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {
  2. This file is part of the Free Component Library
  3. Copyright (c) 2024 by Michael Van Canneyt [email protected]
  4. JSONSchema fpcunit tester program
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$mode objfpc}
  12. {$h+}
  13. program testschema;
  14. uses
  15. {$ifdef unix}
  16. cwstring,
  17. {$endif}
  18. SysUtils, Classes, jsonparser, consoletestrunner, fpjson.schema.schema, fpjson.schema.consts, fpjson.schema.reader,
  19. fpjson.schema.loader, fpjson.schema.testutils, utOfficialTests, fpjson.schema.types, utSchemaTypes, utSchema,
  20. fpjson.schema.writer, utSchemaWriter, fpjson.schema.validator, utSchemaValidator, fpjson.schema.pascaltypes,
  21. fpjson.schema.codegen, utSchemaPascalTypes;
  22. type
  23. { TMyTestRunner }
  24. TMyTestRunner = Class(TTestRunner)
  25. Constructor Create(aOwner : TComponent); override;
  26. end;
  27. var
  28. Application: TTestRunner;
  29. { TMyTestRunner }
  30. constructor TMyTestRunner.Create(aOwner: TComponent);
  31. var
  32. aDir: String;
  33. begin
  34. inherited Create(aOwner);
  35. Longopts.Add('testdir:');
  36. aDir:=GetEnvironmentVariable('SCHEMATESTDIR');
  37. if HasOption(#0,'testdir') then
  38. aDir:=GetOptionValue(#0,'testdir');
  39. if aDir<>'' then
  40. RegisterTestFiles(aDir);
  41. end;
  42. begin
  43. DefaultFormat := fPlain;
  44. DefaultRunAllTests := True;
  45. Application := TMyTestRunner.Create(nil);
  46. Application.Initialize;
  47. Application.Run;
  48. Application.Free;
  49. end.