Bump illuaminate version
For now, we just perform the minimal number of changes to get this working. We'll switch to a more strict bracket handling system in the future.
This commit is contained in:
parent
68762fe84c
commit
68e6bc464b
|
@ -42,7 +42,7 @@ jobs:
|
||||||
- name: Lint Lua code
|
- name: Lint Lua code
|
||||||
run: |
|
run: |
|
||||||
test -d bin || mkdir bin
|
test -d bin || mkdir bin
|
||||||
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/bin/illuaminate
|
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate
|
||||||
chmod +x bin/illuaminate
|
chmod +x bin/illuaminate
|
||||||
bin/illuaminate lint
|
bin/illuaminate lint
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ end
|
||||||
|
|
||||||
function print( ... )
|
function print( ... )
|
||||||
local nLinesPrinted = 0
|
local nLinesPrinted = 0
|
||||||
local nLimit = select("#", ... )
|
local nLimit = select("#", ...)
|
||||||
for n = 1, nLimit do
|
for n = 1, nLimit do
|
||||||
local s = tostring( select( n, ... ) )
|
local s = tostring( select( n, ... ) )
|
||||||
if n < nLimit then
|
if n < nLimit then
|
||||||
|
@ -695,7 +695,7 @@ if http then
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkOptions( options, body )
|
local function checkOptions( options, body )
|
||||||
checkKey( options, "url", "string")
|
checkKey( options, "url", "string" )
|
||||||
if body == false then
|
if body == false then
|
||||||
checkKey( options, "body", "nil" )
|
checkKey( options, "body", "nil" )
|
||||||
else
|
else
|
||||||
|
@ -725,7 +725,7 @@ if http then
|
||||||
return nil, err
|
return nil, err
|
||||||
end
|
end
|
||||||
|
|
||||||
http.get = function( _url, _headers, _binary)
|
http.get = function(_url, _headers, _binary)
|
||||||
if type( _url ) == "table" then
|
if type( _url ) == "table" then
|
||||||
checkOptions( _url, false )
|
checkOptions( _url, false )
|
||||||
return wrapRequest( _url.url, _url )
|
return wrapRequest( _url.url, _url )
|
||||||
|
@ -737,7 +737,7 @@ if http then
|
||||||
return wrapRequest( _url, _url, nil, _headers, _binary )
|
return wrapRequest( _url, _url, nil, _headers, _binary )
|
||||||
end
|
end
|
||||||
|
|
||||||
http.post = function( _url, _post, _headers, _binary)
|
http.post = function(_url, _post, _headers, _binary)
|
||||||
if type( _url ) == "table" then
|
if type( _url ) == "table" then
|
||||||
checkOptions( _url, true )
|
checkOptions( _url, true )
|
||||||
return wrapRequest( _url.url, _url )
|
return wrapRequest( _url.url, _url )
|
||||||
|
|
|
@ -43,7 +43,7 @@ end
|
||||||
|
|
||||||
-- Some methods shouldn't go through redirects, so we move them to the main
|
-- Some methods shouldn't go through redirects, so we move them to the main
|
||||||
-- term API.
|
-- term API.
|
||||||
for _, method in ipairs { "nativePaletteColor", "nativePaletteColour"} do
|
for _, method in ipairs { "nativePaletteColor", "nativePaletteColour" } do
|
||||||
term[method] = native[method]
|
term[method] = native[method]
|
||||||
native[method] = nil
|
native[method] = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -346,10 +346,10 @@ function urlEncode( str )
|
||||||
else
|
else
|
||||||
-- Non-ASCII (encode as UTF-8)
|
-- Non-ASCII (encode as UTF-8)
|
||||||
return
|
return
|
||||||
string.format("%%%02X", 192 + bit32.band( bit32.arshift(n, 6), 31 ) ) ..
|
string.format("%%%02X", 192 + bit32.band( bit32.arshift(n, 6), 31 )) ..
|
||||||
string.format("%%%02X", 128 + bit32.band( n, 63 ) )
|
string.format("%%%02X", 128 + bit32.band( n, 63 ))
|
||||||
end
|
end
|
||||||
end )
|
end)
|
||||||
str = string.gsub(str, " ", "+")
|
str = string.gsub(str, " ", "+")
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
|
|
|
@ -393,7 +393,7 @@ end
|
||||||
-- @treturn Doc The object formatted as a document.
|
-- @treturn Doc The object formatted as a document.
|
||||||
-- @usage Display a table on the screen
|
-- @usage Display a table on the screen
|
||||||
-- local pretty = require "cc.pretty"
|
-- local pretty = require "cc.pretty"
|
||||||
-- pretty.print(pretty.pretty({ 1, 2, 3 })
|
-- pretty.print(pretty.pretty({ 1, 2, 3 }))
|
||||||
local function pretty(obj)
|
local function pretty(obj)
|
||||||
return pretty_impl(obj, {})
|
return pretty_impl(obj, {})
|
||||||
end
|
end
|
||||||
|
|
|
@ -97,7 +97,7 @@ end
|
||||||
-- complete.build(
|
-- complete.build(
|
||||||
-- { complete.choice, { "get", "put" } },
|
-- { complete.choice, { "get", "put" } },
|
||||||
-- complete.dir,
|
-- complete.dir,
|
||||||
-- } complete.file, many = true }
|
-- { complete.file, many = true }
|
||||||
-- )
|
-- )
|
||||||
local function build(...)
|
local function build(...)
|
||||||
local arguments = table.pack(...)
|
local arguments = table.pack(...)
|
||||||
|
|
|
@ -15,7 +15,7 @@ end
|
||||||
|
|
||||||
-- Create .lua files by default
|
-- Create .lua files by default
|
||||||
if not fs.exists( sPath ) and not string.find( sPath, "%." ) then
|
if not fs.exists( sPath ) and not string.find( sPath, "%." ) then
|
||||||
local sExtension = settings.get("edit.default_extension", "" )
|
local sExtension = settings.get("edit.default_extension", "")
|
||||||
if sExtension ~= "" and type( sExtension ) == "string" then
|
if sExtension ~= "" and type( sExtension ) == "string" then
|
||||||
sPath = sPath .. "." .. sExtension
|
sPath = sPath .. "." .. sExtension
|
||||||
end
|
end
|
||||||
|
@ -85,7 +85,7 @@ end
|
||||||
|
|
||||||
local function save( _sPath )
|
local function save( _sPath )
|
||||||
-- Create intervening folder
|
-- Create intervening folder
|
||||||
local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len() )
|
local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len())
|
||||||
if not fs.exists( sDir ) then
|
if not fs.exists( sDir ) then
|
||||||
fs.makeDir( sDir )
|
fs.makeDir( sDir )
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
-- Create .nfp files by default
|
-- Create .nfp files by default
|
||||||
if not fs.exists( sPath ) and not string.find( sPath, "%." ) then
|
if not fs.exists( sPath ) and not string.find( sPath, "%." ) then
|
||||||
local sExtension = settings.get("paint.default_extension", "" )
|
local sExtension = settings.get("paint.default_extension", "")
|
||||||
if sExtension ~= "" and type( sExtension ) == "string" then
|
if sExtension ~= "" and type( sExtension ) == "string" then
|
||||||
sPath = sPath .. "." .. sExtension
|
sPath = sPath .. "." .. sExtension
|
||||||
end
|
end
|
||||||
|
|
|
@ -525,7 +525,7 @@ function InterFace.drawBar()
|
||||||
term.setCursorPos( TermW - 8, TermH )
|
term.setCursorPos( TermW - 8, TermH )
|
||||||
term.setBackgroundColor( colors.black )
|
term.setBackgroundColor( colors.black )
|
||||||
term.setTextColour(InterFace.cSpeedD)
|
term.setTextColour(InterFace.cSpeedD)
|
||||||
write(" <<" )
|
write(" <<")
|
||||||
if bPaused then
|
if bPaused then
|
||||||
term.setTextColour(InterFace.cSpeedA)
|
term.setTextColour(InterFace.cSpeedA)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ function commands.cbreak( _sItem, _sTool )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print( "You can't break " .. sItem .. " with " .. sTool .. ".")
|
print("You can't break " .. sItem .. " with " .. sTool .. ".")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif tItem.creature == true then
|
elseif tItem.creature == true then
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local tArgs = { ... }
|
local tArgs = { ... }
|
||||||
|
|
||||||
local function printUsage()
|
local function printUsage()
|
||||||
print( "Usages:")
|
print( "Usages:" )
|
||||||
print( "dj play" )
|
print( "dj play" )
|
||||||
print( "dj play <drive>" )
|
print( "dj play <drive>" )
|
||||||
print( "dj stop" )
|
print( "dj stop" )
|
||||||
|
|
|
@ -89,7 +89,7 @@ local function drawMenu()
|
||||||
|
|
||||||
term.setTextColour( headingColour )
|
term.setTextColour( headingColour )
|
||||||
term.setCursorPos(w - 11, 1)
|
term.setCursorPos(w - 11, 1)
|
||||||
term.write( "DIFFICULTY ")
|
term.write( "DIFFICULTY " )
|
||||||
|
|
||||||
term.setTextColour( textColour )
|
term.setTextColour( textColour )
|
||||||
term.setCursorPos(w, 1)
|
term.setCursorPos(w, 1)
|
||||||
|
|
|
@ -158,7 +158,7 @@ local block_T = {
|
||||||
bg = colorass(colors.purple, colors.white),
|
bg = colorass(colors.purple, colors.white),
|
||||||
}
|
}
|
||||||
|
|
||||||
local blocks = { block_line, block_square, block_s1, block_s2, block_L1, block_L2, block_T}
|
local blocks = { block_line, block_square, block_s1, block_s2, block_L1, block_L2, block_T }
|
||||||
|
|
||||||
local points = {4, 10, 30, 120}
|
local points = {4, 10, 30, 120}
|
||||||
|
|
||||||
|
|
|
@ -387,7 +387,7 @@ elseif sCommand == "join" then
|
||||||
promptWindow.setCursorPos( 1, 1 )
|
promptWindow.setCursorPos( 1, 1 )
|
||||||
promptWindow.clearLine()
|
promptWindow.clearLine()
|
||||||
promptWindow.setTextColor( highlightColour )
|
promptWindow.setTextColor( highlightColour )
|
||||||
promptWindow.write( ": ")
|
promptWindow.write( ": " )
|
||||||
promptWindow.setTextColor( textColour )
|
promptWindow.setTextColor( textColour )
|
||||||
|
|
||||||
local sChat = read( nil, tSendHistory )
|
local sChat = read( nil, tSendHistory )
|
||||||
|
|
|
@ -43,7 +43,7 @@ end
|
||||||
|
|
||||||
local function completePastebinPut(shell, text, previous)
|
local function completePastebinPut(shell, text, previous)
|
||||||
if previous[2] == "put" then
|
if previous[2] == "put" then
|
||||||
return fs.complete(text, shell.dir(), true, false )
|
return fs.complete( text, shell.dir(), true, false )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ if turtle then
|
||||||
) )
|
) )
|
||||||
shell.setCompletionFunction( "rom/programs/turtle/turn.lua", completion.build(
|
shell.setCompletionFunction( "rom/programs/turtle/turn.lua", completion.build(
|
||||||
{ completion.choice, { "left", "right" }, true, many = true }
|
{ completion.choice, { "left", "right" }, true, many = true }
|
||||||
))
|
) )
|
||||||
shell.setCompletionFunction( "rom/programs/turtle/equip.lua", completion.build(
|
shell.setCompletionFunction( "rom/programs/turtle/equip.lua", completion.build(
|
||||||
nil,
|
nil,
|
||||||
{ completion.choice, { "left", "right" } }
|
{ completion.choice, { "left", "right" } }
|
||||||
|
|
|
@ -356,7 +356,7 @@ function expect_mt:called_with_matching(...)
|
||||||
return called_with_check(matches, self, ...)
|
return called_with_check(matches, self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local expect = setmetatable( {
|
local expect = setmetatable({
|
||||||
--- Construct an expectation on the error message calling this function
|
--- Construct an expectation on the error message calling this function
|
||||||
-- produces
|
-- produces
|
||||||
--
|
--
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
describe("The http library", function()
|
describe("The http library", function()
|
||||||
describe("http.checkURL", function()
|
describe("http.checkURL", function()
|
||||||
it("accepts well formed domains", function()
|
it("accepts well formed domains", function()
|
||||||
expect({ http.checkURL("https://google.com")}):same({ true })
|
expect({ http.checkURL("https://google.com") }):same({ true })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("rejects malformed URLs", function()
|
it("rejects malformed URLs", function()
|
||||||
expect({ http.checkURL("google.com")}):same({ false, "Must specify http or https" })
|
expect({ http.checkURL("google.com") }):same({ false, "Must specify http or https" })
|
||||||
expect({ http.checkURL("https:google.com")}):same({ false, "URL malformed" })
|
expect({ http.checkURL("https:google.com") }):same({ false, "URL malformed" })
|
||||||
expect({ http.checkURL("https:/google.com")}):same({ false, "URL malformed" })
|
expect({ http.checkURL("https:/google.com") }):same({ false, "URL malformed" })
|
||||||
expect({ http.checkURL("wss://google.com")}):same({ false, "Invalid protocol 'wss'" })
|
expect({ http.checkURL("wss://google.com") }):same({ false, "Invalid protocol 'wss'" })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("rejects local domains", function()
|
it("rejects local domains", function()
|
||||||
expect({ http.checkURL("http://localhost")}):same({ false, "Domain not permitted" })
|
expect({ http.checkURL("http://localhost") }):same({ false, "Domain not permitted" })
|
||||||
expect({ http.checkURL("http://127.0.0.1")}):same({ false, "Domain not permitted" })
|
expect({ http.checkURL("http://127.0.0.1") }):same({ false, "Domain not permitted" })
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe("cc.shell.completion", function()
|
||||||
local spec = c.build(
|
local spec = c.build(
|
||||||
function() return { "a", "b", "c" } end,
|
function() return { "a", "b", "c" } end,
|
||||||
nil,
|
nil,
|
||||||
{ c.choice, { "d", "e", "f"} }
|
{ c.choice, { "d", "e", "f" } }
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(spec(shell, 1, "")):same { "a", "b", "c" }
|
expect(spec(shell, 1, "")):same { "a", "b", "c" }
|
||||||
|
|
|
@ -52,14 +52,14 @@ describe("The pastebin program", function()
|
||||||
local file = fs.open( "testup", "w" )
|
local file = fs.open( "testup", "w" )
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
expect(capture(stub, "pastebin", "put", "testup" ))
|
expect(capture(stub, "pastebin", "put", "testup"))
|
||||||
:matches { ok = true, output = "Connecting to pastebin.com... Success.\nUploaded as https://pastebin.com/abcde\nRun \"pastebin get abcde\" to download anywhere\n", error = "" }
|
:matches { ok = true, output = "Connecting to pastebin.com... Success.\nUploaded as https://pastebin.com/abcde\nRun \"pastebin get abcde\" to download anywhere\n", error = "" }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("upload a not existing program to pastebin", function()
|
it("upload a not existing program to pastebin", function()
|
||||||
setup_request()
|
setup_request()
|
||||||
|
|
||||||
expect(capture(stub, "pastebin", "put", "nothing" ))
|
expect(capture(stub, "pastebin", "put", "nothing"))
|
||||||
:matches { ok = true, output = "No such file\n", error = "" }
|
:matches { ok = true, output = "No such file\n", error = "" }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ local capture = require "test_helpers".capture_program
|
||||||
|
|
||||||
describe("The peripherals program", function()
|
describe("The peripherals program", function()
|
||||||
it("says when there are no peripherals", function()
|
it("says when there are no peripherals", function()
|
||||||
expect(capture(stub, "peripherals" ))
|
expect(capture(stub, "peripherals"))
|
||||||
:matches { ok = true, output = "Attached Peripherals:\nNone\n", error = "" }
|
:matches { ok = true, output = "Attached Peripherals:\nNone\n", error = "" }
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue