bluejay 0.0.5

A cross-platform application test script runner.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Bluejay

Cross-platform test script runner.

Bluejay allows you to write test scripts for command-line applications that run on multiple platforms (currently Windows and Linux), so you don't need to write something in both batch and shell scripts (or worse, leave no or few tests for Windows).

Bluejay embeds a Lua interpreter, with a small test library. The ./test directory also functions as a source of examples.

You can run a single test via bluejay my-test.bj or specify a directory (bluejay ./test) to test all bj files within.

#!/usr/bin/env bluejay

-- Test that bluejay executes a program and reads its standard output.

local ret = Test:run("echo", "asdf")

-- We don't care about the whitespace, which is system-dependent.
assert(Util:strip(ret.Output) == "asdf")
assert(ret.ReturnCode == 0)

-- We can also make the assertion based on the host operating system.
if (System.OS == "Windows") then
	assert(ret.Output == "asdf\r\n")
else
	assert(ret.Output == "asdf\n")
end
#!/usr/bin/env bluejay

-- Test that Util:writeFile() writes text to the filesystem.

-- cleanup() will run once the test finishes, regardless of success or failure.
function cleanup()
    Util:removeFile(path)
end

-- Note: If path is declared as local, the cleanup function won't see it.
path = Util:getTempFile()
Util:writeFile(path, "This is some text.")
local text = Util:readFile(path)

assert(text == "This is some text.")
Authors:
Ryan Frame
Dependencies:
luad, tested
Versions:
0.0.5 2017-Aug-11
0.0.4 2017-Aug-02
0.0.2 2017-Aug-02
0.0.1 2017-Jul-31
~master 2017-Aug-11
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 5 downloads this month

  • 5 downloads total