testSuite
Description
implement Test Suite
Installation
Copy one of these commands into your ComputerCraft terminal:
wget:
wget https://raw.githubusercontent.com/mc-cc-scripts/script-manager/master/tests/testSuite.lua testsuiteArchive:
wget https://cc.shobie.xyz/cc/get/gh-mc-cc-scripts-script-manager-tests-testsuite testsuite
Quick Install:
wget https://cc.shobie.xyz/cc/get/gh-mc-cc-scripts-script-manager-tests-testsuite testSuite
Usage
Run: testSuite
Tags
Source
View Original SourceCode Preview
-- implement Test Suite
local json = require("tests/Suite/json")
local https = require("socket.http")
local fs = require("tests/Suite/fs")
local textutils = {}
---@param t table
textutils.serializeJSON = function(t) return json.stringify(t) end
---@param s string
---@return table
textutils.unserializeJSON = function(s) return json.parse(s) end
_G.textutils = textutils
_G.http = {
get = function(...)
local t = https.request(...)
if t == "404: Not Found" and printAllowed then
print("404: Not Found for request: " .. tostring(...))
end
return
{
["readAll"] = function() return t end,
["close"] = function() return end
}
end
}
_G.shell = {
-- TODO: implement shell - CompleteFunction
["setCompletionFunction"] = function(...) return end,
["run"] = function(...) return end
}
-- Just any day, does not matter as of now
_G.os.day = function() return 19574 end
_G.printAllowed = false
_G.fs = fs