diff options
author | Mattes D <github@xoft.cz> | 2016-05-31 01:01:55 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2016-05-31 01:01:55 +0200 |
commit | 5618e453e60219c10ac4d811dc44926ecee7c370 (patch) | |
tree | 3d618336ec689295e950a4177b32d8e8cba8445e /Server/Plugins/Debuggers | |
parent | Merge pull request #3078 from cuberite/AddTerrainGenDocs (diff) | |
download | cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar.gz cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar.bz2 cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar.lz cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar.xz cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.tar.zst cuberite-5618e453e60219c10ac4d811dc44926ecee7c370.zip |
Diffstat (limited to 'Server/Plugins/Debuggers')
-rw-r--r-- | Server/Plugins/Debuggers/Debuggers.lua | 57 | ||||
-rw-r--r-- | Server/Plugins/Debuggers/Info.lua | 6 |
2 files changed, 63 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index ae06b4fc9..aa2205368 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -1921,6 +1921,63 @@ end +function HandleConsoleTestCall(a_Split, a_EntireCmd) + LOG("Testing inter-plugin calls") + LOG("Note: These will fail if the Core plugin is not enabled") + + -- Test calling the HandleConsoleWeather handler: + local pm = cPluginManager + LOG("Calling Core's HandleConsoleWeather") + local isSuccess = pm:CallPlugin("Core", "HandleConsoleWeather", + { + "/weather", + "rain", + } + ) + if (type(isSuccess) == "boolean") then + LOG("Success") + else + LOG("FAILED") + end + + -- Test injecting some code: + LOG("Injecting code into the Core plugin") + isSuccess = pm:CallPlugin("Core", "dofile", pm:GetCurrentPlugin():GetLocalFolder() .. "/Inject.lua") + if (type(isSuccess) == "boolean") then + LOG("Success") + else + LOG("FAILED") + end + + -- Test the full capabilities of the table-passing API, using the injected function: + LOG("Calling injected code") + isSuccess = pm:CallPlugin("Core", "injectedPrintParams", + { + "test", + nil, + { + "test", + "test" + }, + [10] = "test", + ["test"] = "test", + [{"test"}] = "test", + [true] = "test", + } + ) + if (type(isSuccess) == "boolean") then + LOG("Success") + else + LOG("FAILED") + end + + return true +end + + + + + function HandleConsoleTestJson(a_Split, a_EntireCmd) LOG("Testing Json parsing...") local t1 = cJson:Parse([[{"a": 1, "b": "2", "c": [3, "4", 5] }]]) diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua index fa85f0532..af3461342 100644 --- a/Server/Plugins/Debuggers/Info.lua +++ b/Server/Plugins/Debuggers/Info.lua @@ -254,6 +254,12 @@ g_PluginInfo = HelpString = "Tests the world scheduling", }, + ["testcall"] = + { + Handler = HandleConsoleTestCall, + HelpString = "Tests inter-plugin calls with various values" + }, + ["testjson"] = { Handler = HandleConsoleTestJson, |