diff options
author | UebelAndre <github@uebelandre.com> | 2022-02-10 14:00:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 17:00:29 -0500 |
commit | 2bc90bdf7dc9914d126cf8594c3838494fc00d19 (patch) | |
tree | c54c977a8dce85d05f3d7148dd676a38270f814c /lib | |
parent | 7270e3b345371c1b6bbb65f5598dcac48b3593bd (diff) | |
download | bazel-skylib-2bc90bdf7dc9914d126cf8594c3838494fc00d19.tar.gz |
Allow unit test rules to be documented (#343)
I find it more ergonomic to add notes or a description about a test to a `doc` attribute, similar to other rules, vs a comment block above it or in the `impl` function docstring. Hopefully this can improve the readability of test rules.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/unittest.bzl | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/unittest.bzl b/lib/unittest.bzl index feea621..519720c 100644 --- a/lib/unittest.bzl +++ b/lib/unittest.bzl @@ -206,6 +206,7 @@ _action_retrieving_aspect = aspect( # TODO(cparsons): Provide more full documentation on analysis testing in README. def _make_analysis_test( impl, + doc = "", expect_failure = False, attrs = {}, fragments = [], @@ -238,6 +239,7 @@ def _make_analysis_test( Args: impl: The implementation function of the unit test. + doc: A description of the rule that can be extracted by documentation generating tools. expect_failure: 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 @@ -277,6 +279,7 @@ def _make_analysis_test( return rule( impl, + doc = doc, attrs = attrs, fragments = fragments, test = True, |