diff options
author | Mattes D <github@xoft.cz> | 2015-12-25 18:50:25 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-12-25 18:50:25 +0100 |
commit | 958df6ad9192285e0a19caa362f9f0c9e63422d4 (patch) | |
tree | b34c37370e088e18f576357a9645fdf5c02bb0d3 /Server/Plugins/Debuggers | |
parent | Merge pull request #2795 from SafwatHalaby/doors (diff) | |
download | cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar.gz cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar.bz2 cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar.lz cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar.xz cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.tar.zst cuberite-958df6ad9192285e0a19caa362f9f0c9e63422d4.zip |
Diffstat (limited to '')
-rw-r--r-- | Server/Plugins/Debuggers/Debuggers.lua | 41 | ||||
-rw-r--r-- | Server/Plugins/Debuggers/Info.lua | 6 |
2 files changed, 47 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index 0559a4ef8..7058a5025 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -2030,6 +2030,47 @@ end +function HandleConsoleTestUrlParser(a_Split, a_EntireCmd) + LOG("Testing cUrlParser...") + local UrlsToTest = + { + "invalid URL", + "https://github.com", + "ftp://anonymous:user@example.com@ftp.cuberite.org:9921/releases/2015/2015-12-25.zip", + "ftp://anonymous:user:name:with:colons@example.com@ftp.cuberite.org:9921", + "http://google.com/", + "http://google.com/?q=cuberite", + "http://google.com/search?q=cuberite", + "http://google.com/some/search?q=cuberite#results", + "http://google.com/?q=cuberite#results", + "http://google.com/#results", + "ftp://cuberite.org:9921/releases/2015/2015-12-25.zip", + "mailto:support@cuberite.org", + } + for _, u in ipairs(UrlsToTest) do + LOG("URL: " .. u) + local scheme, username, password, host, port, path, query, fragment = cUrlParser:Parse(u) + if not(scheme) then + LOG(" Error: " .. (username or "<nil>")) + else + LOG(" Scheme = " .. scheme) + LOG(" Username = " .. username) + LOG(" Password = " .. password) + LOG(" Host = " .. host) + LOG(" Port = " .. port) + LOG(" Path = " .. path) + LOG(" Query = " .. query) + LOG(" Fragment = " .. fragment) + end + end + LOG("cUrlParser test complete") + return true +end + + + + + function HandleConsoleBBox(a_Split) local bbox = cBoundingBox(0, 10, 0, 10, 0, 10) local v1 = Vector3d(1, 1, 1) diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua index f71ee5509..486cfd0d9 100644 --- a/Server/Plugins/Debuggers/Info.lua +++ b/Server/Plugins/Debuggers/Info.lua @@ -253,6 +253,12 @@ g_PluginInfo = Handler = HandleConsoleTestTracer, HelpString = "Tests the cLineBlockTracer", }, + + ["testurlparser"] = + { + Handler = HandleConsoleTestUrlParser, + HelpString = "Tests the cUrlParser", + }, }, -- ConsoleCommands } -- g_PluginInfo |