mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-25 19:07:39 +00:00
Add more tests (#253)
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.
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
local capture = require "test_helpers".capture_program
|
||||
|
||||
describe("The cd program", function()
|
||||
|
||||
it("cd into a directory", function()
|
||||
shell.run("cd /rom/programs")
|
||||
|
||||
expect(shell.dir()):eq("rom/programs")
|
||||
it("changes into a directory", function()
|
||||
local setDir = stub(shell, "setDir")
|
||||
capture(stub, "cd /rom/programs")
|
||||
expect(setDir):called_with("rom/programs")
|
||||
end)
|
||||
|
||||
it("cd into a not existing directory", function()
|
||||
it("does not move into a non-existent directory", function()
|
||||
expect(capture(stub, "cd /rom/nothing"))
|
||||
:matches { ok = true, output = "Not a directory\n", error = "" }
|
||||
end)
|
||||
|
||||
it("displays the usage with no arguments", function()
|
||||
|
||||
it("displays the usage when given no arguments", function()
|
||||
expect(capture(stub, "cd"))
|
||||
:matches { ok = true, output = "Usage: cd <path>\n", error = "" }
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user