From 2bc90bdf7dc9914d126cf8594c3838494fc00d19 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Thu, 10 Feb 2022 14:00:29 -0800 Subject: 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. --- lib/unittest.bzl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') 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, -- cgit v1.2.3