forked from VSoftTechnologies/DUnitX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DUnitX.CommandLine.pas
139 lines (108 loc) · 4.03 KB
/
DUnitX.CommandLine.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{***************************************************************************}
{ }
{ DUnitX }
{ }
{ Copyright (C) 2013 Vincent Parrett }
{ }
{ http://www.finalbuilder.com }
{ }
{ }
{***************************************************************************}
{ }
{ 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. }
{ }
{***************************************************************************}
unit DUnitX.CommandLine;
interface
{$I DUnitX.inc}
uses
Generics.Collections,
DUnitX.TestFramework;
function CommandLine : ICommandLine;
procedure RegisterCommandLineOption(const optionName: string; const separator : string; const hasValue : boolean);
implementation
uses
classes;
var
_commandLine : ICommandLine;
type
TCommandLine = class(TInterfacedObject,ICommandLine)
private
FParamList : TStringList;
FLogLevel : TLogLevel;
FHideBanner : boolean;
protected
procedure ProcessCommandLine(const sList : TStrings);
//ICommandLine;
function GetLogLevel: TLogLevel;
function GetHideBanner: Boolean;
procedure SetHideBanner(const value : boolean);
function HasOption(const optionName: string): Boolean;
function GetOptionValue(const optionName : string) : string;
public
constructor Create;
destructor Destroy;override;
end;
{ TDUniXCommandLine }
function CommandLine: ICommandLine;
begin
if _commandLine = nil then
_commandLine := TCommandLine.Create;
result := _commandLine;
end;
{ TCommandLine }
constructor TCommandLine.Create;
var
count : integer;
i : integer;
begin
FLogLevel := TLogLevel.ltInformation;
FParamList := TStringList.Create;
//this is intended to make it eaiser to test ProcessCommandLine
count := System.ParamCount;
for i := 0 to count do
FParamList.Add(ParamStr(i));
ProcessCommandLine(FParamList);
end;
function TCommandLine.GetLogLevel: TLogLevel;
begin
result := FLogLevel;
end;
function TCommandLine.GetOptionValue(const optionName: string): string;
begin
end;
destructor TCommandLine.Destroy;
begin
FParamList.Free;
inherited;
end;
function TCommandLine.GetHideBanner: Boolean;
begin
result := FHideBanner;
end;
function TCommandLine.HasOption(const optionName: string): Boolean;
begin
result := False;
end;
procedure TCommandLine.ProcessCommandLine(const sList : TStrings);
begin
end;
procedure TCommandLine.SetHideBanner(const value: boolean);
begin
FHideBanner := true;
end;
procedure RegisterCommandLineOption(const optionName: string; const separator : string; const hasValue : boolean);
begin
end;
end.