* Remove unused variables

git-svn-id: trunk@34538 -
This commit is contained in:
michael 2016-09-17 08:58:22 +00:00
parent 0af46b90aa
commit 4e39c254d2
6 changed files with 42 additions and 38 deletions

View File

@ -406,7 +406,6 @@ Var
PI : PPropInfo;
TI : PTypeInfo;
I,J,S : Integer;
D : Double;
A : TJSONArray;
JS : TJSONStringType;
begin
@ -551,8 +550,6 @@ procedure TJSONDeStreamer.JSONToCollection(const JSON: TJSONData;
Var
I : integer;
A : TJSONArray;
O : TJSONObject;
begin
If (JSON.JSONType=jtArray) then
A:=JSON As TJSONArray
@ -980,10 +977,6 @@ end;
function TJSONStreamer.StreamClassProperty(const AObject: TObject): TJSONData;
Var
C : TCollection;
I : integer;
begin
Result:=Nil;
If (AObject=Nil) then

View File

@ -65,7 +65,6 @@ Resourcestring
SErrUnexpectedEOF = 'Unexpected EOF encountered.';
SErrUnexpectedToken = 'Unexpected token (%s) encountered.';
SErrExpectedColon = 'Expected colon (:), got token "%s".';
SErrUnexpectedComma = 'Invalid comma encountered.';
SErrEmptyElement = 'Empty element encountered.';
SErrExpectedElementName = 'Expected element name, got token "%s"';
SExpectedCommaorBraceClose = 'Expected , or ], got token "%s".';

View File

@ -205,10 +205,10 @@ function TJSONScanner.DoFetchToken: TJSONToken;
end;
var
TokenStart, CurPos: PChar;
TokenStart: PChar;
it : TJSONToken;
I : Integer;
OldLength, SectionLength, Index, tstart,tcol: Integer;
OldLength, SectionLength, tstart,tcol: Integer;
C : char;
S : String;
IsStar,EOC: Boolean;

View File

@ -19,7 +19,7 @@ unit testjsondata;
interface
uses
Classes, SysUtils, fpcunit, testutils, testregistry, fpjson;
Classes, SysUtils, fpcunit, testregistry, fpjson;
type
TMyNull = Class(TJSONNull);
@ -204,6 +204,7 @@ type
Procedure TestClone;
Procedure TestMyClone;
Procedure TestFormat;
Procedure TestFormatNil;
end;
{ TTestObject }
@ -252,6 +253,7 @@ type
procedure TestExtract;
Procedure TestNonExistingAccessError;
Procedure TestFormat;
Procedure TestFormatNil;
Procedure TestFind;
end;
@ -1002,7 +1004,6 @@ end;
procedure TTestJSONPath.TestDeepRecursive;
Var
O : TJSONObject;
A : TJSONArray;
D : TJSONData;
begin
@ -2563,7 +2564,6 @@ procedure TTestArray.TestAddString;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
S:='A string';
@ -2585,8 +2585,6 @@ procedure TTestArray.TestAddNull;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
J:=TJSonArray.Create;
@ -2720,7 +2718,6 @@ procedure TTestArray.TestInsertString;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
S:='A string';
@ -2742,8 +2739,6 @@ end;
procedure TTestArray.TestInsertNull;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
J:=TJSonArray.Create;
@ -2825,11 +2820,8 @@ end;
procedure TTestArray.TestMove;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
S:='A string';
J:=TJSonArray.Create;
try
J.Add('First string');
@ -2849,11 +2841,8 @@ end;
procedure TTestArray.TestExchange;
Var
J : TJSONArray;
S : String;
F : TJSONFloat;
begin
S:='A string';
J:=TJSonArray.Create;
try
J.Add('First string');
@ -2987,7 +2976,7 @@ end;
procedure TTestArray.TestMyClone;
Var
J,J2 : TMyArray;
J : TMyArray;
D : TJSONData;
begin
@ -3010,7 +2999,6 @@ end;
procedure TTestArray.TestFormat;
Var
J : TJSONArray;
I : TJSONData;
begin
J:=TJSonArray.Create;
@ -3033,6 +3021,23 @@ begin
end;
end;
procedure TTestArray.TestFormatNil;
Var
J : TJSONArray;
begin
J:=TJSonArray.Create;
try
J.Add(1);
J.Add(TJSONObject(Nil));
TestJSON(J,'[1, null]');
AssertEquals('FormatJSON, single line',J.AsJSON,J.FormatJSON([foSingleLineArray],1));
finally
J.Free;
end;
end;
{ TTestObject }
procedure TTestObject.TestCreate;
@ -3199,7 +3204,6 @@ Const
Var
J : TJSONObject;
S : String;
F : TJSONFloat;
begin
S:='A string';
@ -3224,8 +3228,6 @@ Const
Var
J : TJSONObject;
S : String;
F : TJSONFloat;
begin
J:=TJSonObject.Create;
@ -3482,6 +3484,23 @@ begin
end;
end;
procedure TTestObject.TestFormatNil;
Var
J : TJSONObject;
begin
J:=TJSONObject.Create;
try
J.Add('a',1);
J.Add('b',TJSONObject(Nil));
TestJSON(J,'{ "a" : 1, "b" : null }');
AssertEquals('FormatJSON, single line',J.AsJSON,J.FormatJSON([foSingleLineObject],1));
finally
J.Free;
end;
end;
procedure TTestObject.TestFind;
Const

View File

@ -19,7 +19,7 @@ unit testjsonparser;
interface
uses
Classes, SysUtils, fpcunit, testutils, testregistry,fpjson,
Classes, SysUtils, fpcunit, testregistry,fpjson,
jsonscanner,jsonParser,testjsondata;
Const

View File

@ -117,7 +117,6 @@ type
FDS : TJSONDeStreamer;
FJD : TJSONData;
FToFree : TObject;
FCalled : Boolean;
procedure DeStream(JSON: TJSONStringType; AObject: TObject);
procedure DeStream(JSON: TJSONObject; AObject: TObject);
procedure DoDateTimeFormat;
@ -1021,7 +1020,6 @@ procedure TTestJSONStreamer.TestCollectionProp2;
Var
C : TCollectionComponent;
F : TJSONObject;
A : TJSONArray;
begin
@ -1057,8 +1055,6 @@ end;
procedure TTestJSONStreamer.TestStringsProp1;
Var
A : TJSONArray;
begin
RJ.Options:=[jsoTstringsAsArray];
StreamObject(TStringsCOmponent.Create(Nil));
@ -1068,8 +1064,6 @@ end;
procedure TTestJSONStreamer.TestStringsProp2;
Var
A : TJSONArray;
begin
StreamObject(TStringsCOmponent.Create(Nil));
AssertPropCount(1);
@ -1267,7 +1261,6 @@ end;
procedure TTestJSONStreamer.TestStringsStream4;
Var
O : TJSONObject;
S : TStringList;
begin
@ -1598,7 +1591,7 @@ begin
AssertEquals('Variant type',VarTypeAsText(varSingle),VarTypeAsText(VarType(C.VariantProp)));
StreamObject(FTofree);
AssertPropCount(1);
AssertProp('VariantProp',3.14);
AssertProp('VariantProp',i);
end;
procedure TTestJSONStreamer.TestVariantdouble;