All library functions no longer require self
This commit is contained in:
@@ -5,13 +5,13 @@ describe("temp files", function()
|
||||
test("temp_dir cleans itself", function()
|
||||
local path
|
||||
do
|
||||
local dir = fs:temp_dir()
|
||||
local dir = fs.temp_dir()
|
||||
path = dir:path()
|
||||
assert(path and path ~= "")
|
||||
fs:write(path .. "/test.txt", "test file")
|
||||
assert(fs:read(path .. "/test.txt") == "test file")
|
||||
fs.write(path .. "/test.txt", "test file")
|
||||
assert(fs.read(path .. "/test.txt") == "test file")
|
||||
end
|
||||
collectgarbage()
|
||||
assert(not pcall(fs.read, fs, path .. "/test.txt"))
|
||||
assert(not pcall(fs.read, path .. "/test.txt"))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -4,14 +4,14 @@ if not ok then return end
|
||||
describe("tcp", function()
|
||||
describe("socket", function()
|
||||
test("bind", function()
|
||||
local socket = net:bind_tcp("127.0.0.1")
|
||||
local socket = net.bind_tcp("127.0.0.1")
|
||||
|
||||
-- binds to the correct port
|
||||
assert(tostring(socket:local_addr():ip()) == "127.0.0.1")
|
||||
assert(socket:local_addr():port() ~= 0)
|
||||
|
||||
-- should not be able to rebind socket
|
||||
assert(not pcall(socket.bind, socket, net:socketaddr("127.0.0.1")))
|
||||
assert(not pcall(socket.bind, socket, net.socketaddr("127.0.0.1")))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -74,7 +74,7 @@ describe("sleep", function()
|
||||
value = "value"
|
||||
end)
|
||||
assert(value == nil)
|
||||
task:sleep(100) -- implicit await: if it's synchronous, value wouldn't change
|
||||
task.sleep(100) -- implicit await: if it's synchronous, value wouldn't change
|
||||
assert(value == "value")
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user