## unittest_toolchain unittest_toolchain(name, failure_templ, file_ext, join_on, success_templ) ### Attributes
unittest_toolchain(name, failure_templ, file_ext, join_on, success_templ)
name
A unique name for this target.
failure_templ
file_ext
join_on
success_templ
analysistest.make(impl, expect_failure, attrs, config_settings)
impl
The implementation function of the unit test.
expect_failure
False
If true, the analysis test will expect the target_under_test to fail. Assertions can be made on the underlying failure using asserts.expect_failure
attrs
{}
An optional dictionary to supplement the attrs passed to the unit test's `rule()` constructor.
config_settings
A dictionary of configuration settings to change for the target under test and its dependencies. This may be used to essentially change 'build flags' for the target under test, and may thus be utilized to test multiple targets with different flags in a single build
analysistest.begin(ctx)
ctx
The Skylark context. Pass the implementation function's `ctx` argument in verbatim.
analysistest.end(env)
env
The test environment returned by `analysistest.begin`.
analysistest.fail(env, msg)
The test environment returned by `unittest.begin`.
msg
The message to log describing the failure.
analysistest.target_actions(env)
analysistest.target_under_test(env)
asserts.expect_failure(env, expected_failure_msg)
expected_failure_msg
""
The error message to expect as a result of analysis failures.
asserts.equals(env, expected, actual, msg)
expected
The expected value of some computation.
actual
The actual value returned by some computation.
None
An optional message that will be printed that describes the failure. If omitted, a default will be used.
asserts.false(env, condition, msg)
condition
A value that will be evaluated in a Boolean context.
"Expected condition to be false, but was true."
asserts.set_equals(env, expected, actual, msg)
The expected set resulting from some computation.
The actual set returned by some computation.
asserts.new_set_equals(env, expected, actual, msg)
asserts.true(env, condition, msg)
"Expected condition to be true, but was false."
register_unittest_toolchains()
unittest.make(impl, attrs)
unittest.suite(name, test_rules)
The name of the `test_suite` target, and the prefix of all the test target names.
test_rules
A list of test rules defines by `unittest.test`.
unittest.begin(ctx)
unittest.end(env)
unittest.fail(env, msg)