-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
1,251 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{******************************************************************************} | ||
{ } | ||
{ Delphi JOSE Library } | ||
{ Copyright (c) 2015-2019 Paolo Rossi } | ||
{ https://github.com/paolo-rossi/delphi-jose-jwt } | ||
{ } | ||
{******************************************************************************} | ||
{ } | ||
{ Licensed under the Apache License, Version 2.0 (the "License"); } | ||
{ you may not use this file except in compliance with the License. } | ||
{ You may obtain a copy of the License at } | ||
{ } | ||
{ http://www.apache.org/licenses/LICENSE-2.0 } | ||
{ } | ||
{ Unless required by applicable law or agreed to in writing, software } | ||
{ distributed under the License is distributed on an "AS IS" BASIS, } | ||
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } | ||
{ See the License for the specific language governing permissions and } | ||
{ limitations under the License. } | ||
{ } | ||
{******************************************************************************} | ||
program JOSE.Tests; | ||
|
||
{$IFNDEF TESTINSIGHT} | ||
{$APPTYPE CONSOLE} | ||
{$ENDIF} | ||
|
||
{$STRONGLINKTYPES ON} | ||
uses | ||
System.SysUtils, | ||
{$IFDEF TESTINSIGHT} | ||
TestInsight.DUnitX, | ||
{$ENDIF } | ||
DUnitX.Loggers.Console, | ||
DUnitX.Loggers.Xml.NUnit, | ||
DUnitX.TestFramework, | ||
JOSE.Tests.Builder in 'Source\JOSE.Tests.Builder.pas', | ||
JOSE.Tests.Consumer in 'Source\JOSE.Tests.Consumer.pas', | ||
JOSE.Tests.JWA in 'Source\JOSE.Tests.JWA.pas', | ||
JOSE.Tests.JWK in 'Source\JOSE.Tests.JWK.pas', | ||
JOSE.Tests.JWS in 'Source\JOSE.Tests.JWS.pas', | ||
JOSE.Tests.JWT in 'Source\JOSE.Tests.JWT.pas', | ||
JOSE.Tests.Utils in 'Source\JOSE.Tests.Utils.pas', | ||
JOSE.Tests.Common in 'Source\JOSE.Tests.Common.pas'; | ||
|
||
var | ||
LRunner : ITestRunner; | ||
LResults : IRunResults; | ||
LLogger : ITestLogger; | ||
LNUnitLogger : ITestLogger; | ||
begin | ||
{$IFDEF TESTINSIGHT} | ||
TestInsight.DUnitX.RunRegisteredTests; | ||
Exit; | ||
{$ENDIF} | ||
try | ||
//Check command line options, will exit if invalid | ||
TDUnitX.CheckCommandLine; | ||
//Create the test runner | ||
LRunner := TDUnitX.CreateRunner; | ||
//Tell the runner to use RTTI to find Fixtures | ||
LRunner.UseRTTI := True; | ||
//tell the runner how we will log things | ||
//Log to the console window | ||
LLogger := TDUnitXConsoleLogger.Create(true); | ||
LRunner.AddLogger(LLogger); | ||
//Generate an NUnit compatible XML File | ||
LNUnitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); | ||
LRunner.AddLogger(LNUnitLogger); | ||
LRunner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests; | ||
|
||
//Run tests | ||
LResults := LRunner.Execute; | ||
if not LResults.AllPassed then | ||
System.ExitCode := EXIT_ERRORS; | ||
|
||
{$IFNDEF CI} | ||
//We don't want this happening when running under CI. | ||
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then | ||
begin | ||
System.Write('Done.. press <Enter> key to quit.'); | ||
System.Readln; | ||
end; | ||
{$ENDIF} | ||
except | ||
on E: Exception do | ||
System.Writeln(E.ClassName, ': ', E.Message); | ||
end; | ||
end. |
Oops, something went wrong.