From cdd0afdfe63afedac43fd15c1d60bd23b2241e24 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Thu, 10 Feb 2022 14:55:11 -0800 Subject: [PATCH] Fixed positional args for unittest targets (#352) Followup to https://github.com/bazelbuild/bazel-skylib/pull/343 --- docs/unittest_doc.md | 6 +++--- lib/unittest.bzl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/unittest_doc.md b/docs/unittest_doc.md index 754ea32..5472d74 100755 --- a/docs/unittest_doc.md +++ b/docs/unittest_doc.md @@ -37,8 +37,8 @@ unittest_toolchain(name, impl, doc, expect_failure, attrs, fragments, config_settings, - extra_target_under_test_aspects) +analysistest.make(impl, expect_failure, attrs, fragments, config_settings, + extra_target_under_test_aspects, doc) Creates an analysis test rule from its implementation function. @@ -73,12 +73,12 @@ Recall that names of test rules must end in `_test`. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | impl | The implementation function of the unit test. | none | -| 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 | False | | attrs | An optional dictionary to supplement the attrs passed to the unit test's rule() constructor. | {} | | fragments | An optional list of fragment names that can be used to give rules access to language-specific parts of configuration. | [] | | 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 | {} | | extra_target_under_test_aspects | An optional list of aspects to apply to the target_under_test in addition to those set up by default for the test harness itself. | [] | +| doc | A description of the rule that can be extracted by documentation generating tools. | "" | **RETURNS** diff --git a/lib/unittest.bzl b/lib/unittest.bzl index 519720c..3757b08 100644 --- a/lib/unittest.bzl +++ b/lib/unittest.bzl @@ -206,12 +206,12 @@ _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 = [], config_settings = {}, - extra_target_under_test_aspects = []): + extra_target_under_test_aspects = [], + doc = ""): """Creates an analysis test rule from its implementation function. An analysis test verifies the behavior of a "real" rule target by examining @@ -239,7 +239,6 @@ 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 @@ -252,6 +251,7 @@ def _make_analysis_test( flags in a single build extra_target_under_test_aspects: An optional list of aspects to apply to the target_under_test in addition to those set up by default for the test harness itself. + doc: A description of the rule that can be extracted by documentation generating tools. Returns: A rule definition that should be stored in a global whose name ends in