|
@@ -53,7 +53,7 @@ type
|
|
|
Procedure SetUp; override;
|
|
|
Procedure TestItemCount(J : TJSONData;Expected : Integer);
|
|
|
Procedure TestJSONType(J : TJSONData;Expected : TJSONType);
|
|
|
- Procedure TestJSON(J : TJSONData;Expected : String);
|
|
|
+ Procedure TestJSON(J : TJSONData;Expected : TJSONStringType);
|
|
|
Procedure TestIsNull(J : TJSONData;Expected : Boolean);
|
|
|
Procedure TestAsBoolean(J : TJSONData;Expected : Boolean; ExpectError : boolean = False);
|
|
|
Procedure TestAsInteger(J : TJSONData; Expected : Integer; ExpectError : boolean = False);
|
|
@@ -239,6 +239,7 @@ type
|
|
|
procedure TestCreateBooleanUnquoted;
|
|
|
procedure TestCreateObject;
|
|
|
procedure TestCreateJSONUnicodeString;
|
|
|
+ procedure TestCreateJSONWideString;
|
|
|
procedure TestCreateJSONString;
|
|
|
procedure TestCreateJSONStringUnquoted;
|
|
|
procedure TestCreateJSONObject;
|
|
@@ -1079,7 +1080,7 @@ begin
|
|
|
AssertEquals(J.ClassName+'.JSONType',Ord(Expected),Ord(J.JSONType));
|
|
|
end;
|
|
|
|
|
|
-Procedure TTestJSON.TestJSON(J: TJSONData; Expected: String);
|
|
|
+Procedure TTestJSON.TestJSON(J: TJSONData; Expected: TJSONStringType);
|
|
|
begin
|
|
|
AssertEquals(J.ClassName+'.AsJSON',Expected,J.AsJSON);
|
|
|
end;
|
|
@@ -3940,7 +3941,26 @@ begin
|
|
|
try
|
|
|
TestItemCount(O,1);
|
|
|
TestJSONType(O[A],jtString);
|
|
|
- TestJSON(O,'{ "A" : "'+S+'" }');
|
|
|
+ TestJSON(O,'{ "A" : "'+UTF8Encode(S)+'" }');
|
|
|
+ finally
|
|
|
+ FreeAndNil(O);
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TTestObject.TestCreateJSONWideString;
|
|
|
+Const
|
|
|
+ A = 'A';
|
|
|
+ W : WideString = 'A string';
|
|
|
+
|
|
|
+Var
|
|
|
+ O : TJSONObject;
|
|
|
+
|
|
|
+begin
|
|
|
+ O:=TJSONObject.Create([A,W]);
|
|
|
+ try
|
|
|
+ TestItemCount(O,1);
|
|
|
+ TestJSONType(O[A],jtString);
|
|
|
+ TestJSON(O,'{ "A" : "'+UTF8Encode(W)+'" }');
|
|
|
finally
|
|
|
FreeAndNil(O);
|
|
|
end;
|