mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-25 22:53:22 +00:00
![JakobDev](/assets/img/avatar_default.png)
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.
20 lines
681 B
Lua
20 lines
681 B
Lua
local capture = require "test_helpers".capture_program
|
|
|
|
describe("The cd program", function()
|
|
it("changes into a directory", function()
|
|
local setDir = stub(shell, "setDir")
|
|
capture(stub, "cd /rom/programs")
|
|
expect(setDir):called_with("rom/programs")
|
|
end)
|
|
|
|
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 when given no arguments", function()
|
|
expect(capture(stub, "cd"))
|
|
:matches { ok = true, output = "Usage: cd <path>\n", error = "" }
|
|
end)
|
|
end)
|