Browse Source

* Patch from Luiz Americo to fix TJSONBoolean.AsString, also fixed testcases

git-svn-id: trunk@15854 -
michael 15 years ago
parent
commit
f939bb3848

+ 1 - 1
packages/fcl-json/src/fpjson.pp

@@ -724,7 +724,7 @@ end;
 
 function TJSONboolean.GetAsString: TJSONStringType;
 begin
-  Result:=BoolToStr(FValue);
+  Result:=BoolToStr(FValue, True);
 end;
 
 procedure TJSONboolean.SetAsString(const AValue: TJSONStringType);

+ 7 - 2
packages/fcl-json/tests/testjson.lpi

@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="7"/>
+    <Version Value="8"/>
     <General>
       <Flags>
         <LRSInOutputDirectory Value="False"/>
@@ -58,10 +58,15 @@
     </Units>
   </ProjectOptions>
   <CompilerOptions>
-    <Version Value="8"/>
+    <Version Value="9"/>
     <SearchPaths>
       <OtherUnitFiles Value="../src/"/>
     </SearchPaths>
+    <Parsing>
+      <SyntaxOptions>
+        <UseAnsiStrings Value="False"/>
+      </SyntaxOptions>
+    </Parsing>
     <Other>
       <CompilerPath Value="$(CompPath)"/>
     </Other>

+ 2 - 2
packages/fcl-json/tests/testjsondata.pp

@@ -399,7 +399,7 @@ begin
     TestAsBoolean(J,True);
     TestAsInteger(J,1);
     TestAsInt64(J,1);
-    TestAsString(J,BoolToStr(True));
+    TestAsString(J,BoolToStr(True,True));
     TestAsFloat(J,1.0);
   finally
     FreeAndNil(J);
@@ -421,7 +421,7 @@ begin
     TestAsBoolean(J,False);
     TestAsInteger(J,0);
     TestAsInt64(J,0);
-    TestAsString(J,BoolToStr(False));
+    TestAsString(J,BoolToStr(False,True));
     TestAsFloat(J,0.0);
   finally
     FreeAndNil(J);