Codechange: add tests for GS <-> AdminPort JSON conversion (#11252)

While at it, fix a bug where booleans were made integers.
This commit is contained in:
Patric Stout
2023-08-31 21:38:15 +02:00
committed by GitHub
parent 993e7be707
commit 7afd686541
5 changed files with 180 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ public:
static bool Send(void *table);
#endif /* DOXYGEN_API */
private:
protected:
/**
* Convert a Squirrel structure into a JSON string.
* @param vm The VM to operate on.

View File

@@ -222,11 +222,11 @@ const char *ScriptEventAdminPort::ReadValue(HSQUIRRELVM vm, const char *p)
SKIP_EMPTY(p);
if (strncmp(p, "false", 5) == 0) {
sq_pushinteger(vm, 0);
sq_pushbool(vm, 0);
return p + 5;
}
if (strncmp(p, "true", 4) == 0) {
sq_pushinteger(vm, 1);
sq_pushbool(vm, 1);
return p + 4;
}
if (strncmp(p, "null", 4) == 0) {

View File

@@ -44,6 +44,7 @@ typedef bool (ScriptAsyncModeProc)();
class ScriptObject : public SimpleCountedObject {
friend class ScriptInstance;
friend class ScriptController;
friend class TestScriptController;
protected:
/**
* A class that handles the current active instance. By instantiating it at