]> gitweb.factorcode.org Git - factor.git/commitdiff
json: add special case and test for "-0" case
authorRaghu R <raghuallthetime@hotmail.com>
Sat, 28 Oct 2023 14:44:20 +0000 (22:44 +0800)
committerGitHub <noreply@github.com>
Sat, 28 Oct 2023 14:44:20 +0000 (22:44 +0800)
basis/json/json-tests.factor
basis/json/json.factor

index 0f8225d109191172e2a136861b2b13b7836ef556..469fe34aca8e721736988ab79bc0428e726d6c1a 100644 (file)
@@ -33,6 +33,7 @@ IN: json.tests
 ! not widely supported by javascript, but allowed in the grammar, and a nice
 ! feature to get
 { -0.0 } [ "-0.0" json> ] unit-test
+{ -0.0 } [ "-0" json> ] unit-test
 
 { " fuzzy  pickles " } [ "  \" fuzzy  pickles \" "  json> ] unit-test
 { "while 1:\n\tpass" } [ "  \"while 1:\n\tpass\" "  json> ] unit-test
index 021bfeb1f98262ba1fe6f50335832b4f4ed36360..2d70e2a6c9af1560c33db0f276ba0be4d49ae1ab 100644 (file)
@@ -42,6 +42,7 @@ SYMBOL: json-depth
             { "Infinity" [ 1/0. ] }
             { "-Infinity" [ -1/0. ] }
             { "NaN" [ 0/0. ] }
+            { "-0" [ -0.0 ] }
             [ [ string>number ] [ not-a-json-number ] ?unless ]
         } case
     ] dip ;