JSON5 in dbStatic: Update bare-word JSON keys

Our bare-word character set is wider than JSON5's. Quote any
keys containing the extra characters so YAJL can parse them,
but don't quote keys unnecessarily.

Tests for this behavior are in dbStaticTest.db

Adjust the other tests that read links parsed by the dbStatic
parser that used bareword keys, which are no longer quoted.
This commit is contained in:
Andrew Johnson
2020-08-09 00:33:07 -05:00
parent 0fca5fc8a9
commit 0c800d4428
4 changed files with 22 additions and 8 deletions
@@ -75,18 +75,18 @@ static void testRetargetJLink(void)
testdbGetFieldEqual("rec:j1", DBF_DOUBLE, 10.0);
/* minimal args */
testLongStrEq("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":5}}");
testLongStrEq("rec:j1.INP$", "{calc:{expr:\"A+5\",args:5}}");
/* with [] */
testPutLongStr("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[7]}}");
testdbPutFieldOk("rec:j1.PROC", DBF_LONG, 1);
/* with const */
testPutLongStr("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[{\"const\":7}]}}");
testPutLongStr("rec:j1.INP$", "{calc:{expr:\"A+5\",args:[{const:7}]}}");
testdbPutFieldOk("rec:j1.PROC", DBF_LONG, 1);
testdbGetFieldEqual("rec:j1", DBF_DOUBLE, 12.0);
testLongStrEq("rec:j1.INP$", "{\"calc\":{\"expr\":\"A+5\",\"args\":[{\"const\":7}]}}");
testLongStrEq("rec:j1.INP$", "{calc:{expr:\"A+5\",args:[{const:7}]}}");
}
MAIN(linkRetargetLinkTest)