summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/Debuggers')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua47
-rw-r--r--MCServer/Plugins/Debuggers/Info.lua2
2 files changed, 43 insertions, 6 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index d0c362ab4..01a5de81e 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -9,7 +9,7 @@ g_ShowFoodStats = false; -- When true, each player's food stats are sent to the
-function Initialize(Plugin)
+function Initialize(a_Plugin)
--[[
-- Test multiple hook handlers:
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick1);
@@ -45,14 +45,12 @@ function Initialize(Plugin)
-- Bind all the console commands:
RegisterPluginInfoConsoleCommands();
- Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers)
- Plugin:AddWebTab("StressTest", HandleRequest_StressTest)
+ a_Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers)
+ a_Plugin:AddWebTab("StressTest", HandleRequest_StressTest)
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
- LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
-
-- TestBlockAreas()
-- TestSQLiteBindings()
-- TestExpatBindings()
@@ -62,6 +60,11 @@ function Initialize(Plugin)
TestStringBase64()
-- TestUUIDFromName()
-- TestRankMgr()
+ TestFileExt()
+ TestFileLastMod()
+
+ local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua")
+ LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod))
--[[
-- Test cCompositeChat usage in console-logging:
@@ -79,6 +82,40 @@ end;
+function TestFileExt()
+ assert(cFile:ChangeFileExt("fileless_dir/", "new") == "fileless_dir/")
+ assert(cFile:ChangeFileExt("fileless_dir/", ".new") == "fileless_dir/")
+ assert(cFile:ChangeFileExt("pathless_file.ext", "new") == "pathless_file.new")
+ assert(cFile:ChangeFileExt("pathless_file.ext", ".new") == "pathless_file.new")
+ assert(cFile:ChangeFileExt("path/to/file.ext", "new") == "path/to/file.new")
+ assert(cFile:ChangeFileExt("path/to/file.ext", ".new") == "path/to/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file", "new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file", ".new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.ext", "new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.ext", ".new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.longext", "new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.longext", ".new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.", "new") == "path/to.dir/file.new")
+ assert(cFile:ChangeFileExt("path/to.dir/file.", ".new") == "path/to.dir/file.new")
+end
+
+
+
+
+
+function TestFileLastMod()
+ local f = assert(io.open("test.txt", "w"))
+ f:write("test")
+ f:close()
+ local filetime = cFile:GetLastModificationTime("test.txt")
+ local ostime = os.time()
+ LOG("file time: " .. filetime .. ", OS time: " .. ostime .. ", difference: " .. ostime - filetime)
+end
+
+
+
+
+
function TestPluginCalls()
-- In order to test the inter-plugin communication, we're going to call Core's ReturnColorFromChar() function
-- It is a rather simple function that doesn't need any tables as its params and returns a value, too
diff --git a/MCServer/Plugins/Debuggers/Info.lua b/MCServer/Plugins/Debuggers/Info.lua
index 0370145df..2e170487b 100644
--- a/MCServer/Plugins/Debuggers/Info.lua
+++ b/MCServer/Plugins/Debuggers/Info.lua
@@ -28,7 +28,7 @@ g_PluginInfo =
Handler = HandleCompo,
HelpString = "Tests the cCompositeChat bindings"
},
- ["/cs"] =
+ ["/cstay"] =
{
Permission = "debuggers",
Handler = HandleChunkStay,