mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-13 16:56:49 +00:00
e05c262468
I'm not entirely sure how useful all of these will be yet - still trying to work out what/when to test things, but hopefully this'll be a useful datapoint.
23 lines
811 B
Lua
23 lines
811 B
Lua
local capture = require "test_helpers".capture_program
|
|
|
|
describe("The list program", function()
|
|
it("lists files", function()
|
|
local pagedTabulate = stub(textutils, "pagedTabulate")
|
|
capture(stub, "list /rom")
|
|
expect(pagedTabulate):called_with_matching(
|
|
colors.green, { "apis", "autorun", "help", "modules", "programs" },
|
|
colors.white, { "motd.txt", "startup.lua" }
|
|
)
|
|
end)
|
|
|
|
it("fails on a non-existent directory", function()
|
|
expect(capture(stub, "list /rom/nothing"))
|
|
:matches { ok = true, output = "", error = "Not a directory\n" }
|
|
end)
|
|
|
|
it("fails on a file", function()
|
|
expect(capture(stub, "list /rom/startup.lua"))
|
|
:matches { ok = true, output = "", error = "Not a directory\n" }
|
|
end)
|
|
end)
|