Skip to content

Test Runner

This content is for v1.0. Switch to the latest version for up-to-date documentation.

RayQuiro 0.2.2 comes with a built-in automated test runner.

Terminal window
# Run all tests in the project (searches tests/ or *_test.rq files)
rqio test
# Run tests in a specific directory or file
rqio test tests/01_basic_syntax.rq
rqio test tests/

You can write tests with assertions directly in your script:

var name = "RayQuiro";
var ver = 2;
var banner = f"{name} v0.{ver}";
assert_eq(banner, "RayQuiro v0.2");
var status = 200;
var statusText = "";
match status {
200 => statusText = "OK",
404 => statusText = "Not Found",
_ => statusText = "Unknown"
}
assert_eq(statusText, "OK");
assert(10 > 5, "Math check failed");
assert_true(true);
assert_false(false);
assert_null(null);
assert_ne(1, 2);
FunctionDescription
assert(condition, message)Asserts that condition is truthy
assert_eq(actual, expected, message)Asserts that actual == expected
assert_ne(actual, expected, message)Asserts that actual != expected
assert_true(value, message)Asserts that value is true
assert_false(value, message)Asserts that value is false
assert_null(value, message)Asserts that value is null