v |
required.
diff --git a/docs/unittest_doc.md b/docs/unittest_doc.md
index 8b65765..2256d12 100755
--- a/docs/unittest_doc.md
+++ b/docs/unittest_doc.md
@@ -52,654 +52,10 @@ unittest_toolchain(name,
-## _ActionInfo
+## analysistest.make
-_ActionInfo(actions)
-
-
-
-
-### Fields
-
-
-
-
-
-
-
-
- actions |
-
- (Undocumented)
- |
-
-
-
-
-
-
-## _UnittestToolchainInfo
-
-
-_UnittestToolchainInfo(file_ext, success_templ, failure_templ, join_on)
-
-
-Execution platform information for rules in the bazel_skylib repository.
-
-### Fields
-
-
-
-
-
-
-
-
- file_ext |
-
- (Undocumented)
- |
-
-
- success_templ |
-
- (Undocumented)
- |
-
-
- failure_templ |
-
- (Undocumented)
- |
-
-
- join_on |
-
- (Undocumented)
- |
-
-
-
-
-
-## _action_retrieving_aspect_impl
-
-
-_action_retrieving_aspect_impl(target, ctx)
-
-
-
-
-### Parameters
-
-
-
-
-
-
-
-
- ctx |
-
- required.
- |
-
-
-
-
-
-## _assert_equals
-
-
-_assert_equals(env, expected, actual, msg)
-
-
-Asserts that the given `expected` and `actual` values are equal.
-
-### Parameters
-
-
-
-
-
-
-
-
- expected |
-
- required.
-
- The expected value of some computation.
-
- |
-
-
- msg |
-
- optional. default is None
-
- An optional message that will be printed that describes the failure.
- If omitted, a default will be used.
-
- |
-
-
-
-
-
-## _assert_false
-
-
-_assert_false(env, condition, msg)
-
-
-Asserts that the given `condition` is false.
-
-### Parameters
-
-
-
-
-
-
-
-
- condition |
-
- required.
-
- A value that will be evaluated in a Boolean context.
-
- |
-
-
-
- An optional message that will be printed that describes the failure.
- If omitted, a default will be used.
-
-
-
-
-
-
-
-## _assert_new_set_equals
-
-
-_assert_new_set_equals(env, expected, actual, msg)
-
-
-Asserts that the given `expected` and `actual` sets are equal.
-
-### Parameters
-
-
-
-
-
-
-
-
- expected |
-
- required.
-
- The expected set resulting from some computation.
-
- |
-
-
- msg |
-
- optional. default is None
-
- An optional message that will be printed that describes the failure.
- If omitted, a default will be used.
-
- |
-
-
-
-
-
-## _assert_set_equals
-
-
-_assert_set_equals(env, expected, actual, msg)
-
-
-Asserts that the given `expected` and `actual` sets are equal.
-
-### Parameters
-
-
-
-
-
-
-
-
- expected |
-
- required.
-
- The expected set resulting from some computation.
-
- |
-
-
- msg |
-
- optional. default is None
-
- An optional message that will be printed that describes the failure.
- If omitted, a default will be used.
-
- |
-
-
-
-
-
-## _assert_true
-
-
-_assert_true(env, condition, msg)
-
-
-Asserts that the given `condition` is true.
-
-### Parameters
-
-
-
-
-
-
-
-
- condition |
-
- required.
-
- A value that will be evaluated in a Boolean context.
-
- |
-
-
-
- An optional message that will be printed that describes the failure.
- If omitted, a default will be used.
-
-
-
-
-
-
-
-## _begin
-
-
-_begin(ctx)
-
-
-Begins a unit test.
-
-This should be the first function called in a unit test implementation
-function. It initializes a "test environment" that is used to collect
-assertion failures so that they can be reported and logged at the end of the
-test.
-
-
-### Parameters
-
-
-
-
-
-
-
- env)
-
-
-Ends a unit test and logs the results.
-
-This must be called and returned at the end of a unit test implementation function so
-that the results are reported.
-
-
-### Parameters
-
-
-
-
-
-
-
- env)
-
-
-Ends an analysis test and logs the results.
-
-This must be called and returned at the end of an analysis test implementation function so
-that the results are reported.
-
-
-### Parameters
-
-
-
-
-
-
-
- env, expected_failure_msg)
-
-
-Asserts that the target under test has failed with a given error message.
-
-This requires that the analysis test is created with `analysistest.make()` and
-`expect_failures = True` is specified.
-
-
-### Parameters
-
-
-
-
-
-
-
-
- expected_failure_msg |
-
- optional. default is ""
-
- The error message to expect as a result of analysis failures.
-
- |
-
-
-
-
-
-## _fail
-
-
-_fail(env, msg)
-
-
-Unconditionally causes the current test to fail.
-
-### Parameters
-
-
-
-
-
-
-
-
- msg |
-
- required.
-
- The message to log describing the failure.
-
- |
-
-
-
-
-
-## _impl_function_name
-
-
-_impl_function_name(impl)
-
-
-Derives the name of the given rule implementation function.
-
-This can be used for better test feedback.
-
-### Parameters
-
-
-
-
-
-
-
- impl, attrs)
-
-
-Creates a unit test rule from its implementation function.
-
-Each unit test is defined in an implementation function that must then be
-associated with a rule so that a target can be built. This function handles
-the boilerplate to create and return a test rule and captures the
-implementation function's name so that it can be printed in test feedback.
-
-The optional `attrs` argument can be used to define dependencies for this
-test, in order to form unit tests of rules.
-
-An example of a unit test:
-
-```
-def _your_test(ctx):
- env = unittest.begin(ctx)
-
- # Assert statements go here
-
- return unittest.end(env)
-
-your_test = unittest.make(_your_test)
-```
-
-Recall that names of test rules must end in `_test`.
-
-
-### Parameters
-
-
-
-
-
-
-
-
- attrs |
-
- optional. default is None
-
- An optional dictionary to supplement the attrs passed to the
- unit test's `rule()` constructor.
-
- |
-
-
-
-
-
-## _make_analysis_test
-
-
-_make_analysis_test(impl, expect_failure, config_settings)
+analysistest.make(impl, expect_failure, config_settings)
Creates an analysis test rule from its implementation function.
@@ -736,7 +92,7 @@ Recall that names of test rules must end in `_test`.
-
impl |
required.
@@ -745,7 +101,7 @@ Recall that names of test rules must end in `_test`.
|
-
expect_failure |
optional. default is False
@@ -755,7 +111,7 @@ Recall that names of test rules must end in `_test`.
|
-
config_settings |
optional. default is {}
@@ -771,10 +127,557 @@ Recall that names of test rules must end in `_test`.
|
-## _suite
+## analysistest.begin
-_suite(name, test_rules)
+analysistest.begin(ctx)
+
+
+Begins a unit test.
+
+This should be the first function called in a unit test implementation
+function. It initializes a "test environment" that is used to collect
+assertion failures so that they can be reported and logged at the end of the
+test.
+
+
+### Parameters
+
+
+
+
+
+
+
+
+ ctx |
+
+ required.
+
+ The Skylark context. Pass the implementation function's `ctx` argument
+ in verbatim.
+
+ |
+
+
+
+
+
+## analysistest.end
+
+
+analysistest.end(env)
+
+
+Ends an analysis test and logs the results.
+
+This must be called and returned at the end of an analysis test implementation function so
+that the results are reported.
+
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `analysistest.begin`.
+
+ |
+
+
+
+
+
+## analysistest.fail
+
+
+analysistest.fail(env, msg)
+
+
+Unconditionally causes the current test to fail.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ msg |
+
+ required.
+
+ The message to log describing the failure.
+
+ |
+
+
+
+
+
+## analysistest.target_actions
+
+
+analysistest.target_actions(env)
+
+
+Returns a list of actions registered by the target under test.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `analysistest.begin`.
+
+ |
+
+
+
+
+
+## analysistest.target_under_test
+
+
+analysistest.target_under_test(env)
+
+
+Returns the target under test.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `analysistest.begin`.
+
+ |
+
+
+
+
+
+## asserts.expect_failure
+
+
+asserts.expect_failure(env, expected_failure_msg)
+
+
+Asserts that the target under test has failed with a given error message.
+
+This requires that the analysis test is created with `analysistest.make()` and
+`expect_failures = True` is specified.
+
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `analysistest.begin`.
+
+ |
+
+
+ expected_failure_msg |
+
+ optional. default is ""
+
+ The error message to expect as a result of analysis failures.
+
+ |
+
+
+
+
+
+## asserts.equals
+
+
+asserts.equals(env, expected, actual, msg)
+
+
+Asserts that the given `expected` and `actual` values are equal.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ expected |
+
+ required.
+
+ The expected value of some computation.
+
+ |
+
+
+ actual |
+
+ required.
+
+ The actual value returned by some computation.
+
+ |
+
+
+ msg |
+
+ optional. default is None
+
+ An optional message that will be printed that describes the failure.
+ If omitted, a default will be used.
+
+ |
+
+
+
+
+
+## asserts.false
+
+
+asserts.false(env, condition, msg)
+
+
+Asserts that the given `condition` is false.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ condition |
+
+ required.
+
+ A value that will be evaluated in a Boolean context.
+
+ |
+
+
+ msg |
+
+ optional. default is "Expected condition to be false, but was true."
+
+ An optional message that will be printed that describes the failure.
+ If omitted, a default will be used.
+
+ |
+
+
+
+
+
+## asserts.set_equals
+
+
+asserts.set_equals(env, expected, actual, msg)
+
+
+Asserts that the given `expected` and `actual` sets are equal.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ expected |
+
+ required.
+
+ The expected set resulting from some computation.
+
+ |
+
+
+ actual |
+
+ required.
+
+ The actual set returned by some computation.
+
+ |
+
+
+ msg |
+
+ optional. default is None
+
+ An optional message that will be printed that describes the failure.
+ If omitted, a default will be used.
+
+ |
+
+
+
+
+
+## asserts.new_set_equals
+
+
+asserts.new_set_equals(env, expected, actual, msg)
+
+
+Asserts that the given `expected` and `actual` sets are equal.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ expected |
+
+ required.
+
+ The expected set resulting from some computation.
+
+ |
+
+
+ actual |
+
+ required.
+
+ The actual set returned by some computation.
+
+ |
+
+
+ msg |
+
+ optional. default is None
+
+ An optional message that will be printed that describes the failure.
+ If omitted, a default will be used.
+
+ |
+
+
+
+
+
+## asserts.true
+
+
+asserts.true(env, condition, msg)
+
+
+Asserts that the given `condition` is true.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ condition |
+
+ required.
+
+ A value that will be evaluated in a Boolean context.
+
+ |
+
+
+ msg |
+
+ optional. default is "Expected condition to be true, but was false."
+
+ An optional message that will be printed that describes the failure.
+ If omitted, a default will be used.
+
+ |
+
+
+
+
+
+## register_unittest_toolchains
+
+
+register_unittest_toolchains()
+
+
+Registers the toolchains for unittest users.
+
+
+
+## unittest.make
+
+
+unittest.make(impl, attrs)
+
+
+Creates a unit test rule from its implementation function.
+
+Each unit test is defined in an implementation function that must then be
+associated with a rule so that a target can be built. This function handles
+the boilerplate to create and return a test rule and captures the
+implementation function's name so that it can be printed in test feedback.
+
+The optional `attrs` argument can be used to define dependencies for this
+test, in order to form unit tests of rules.
+
+An example of a unit test:
+
+```
+def _your_test(ctx):
+ env = unittest.begin(ctx)
+
+ # Assert statements go here
+
+ return unittest.end(env)
+
+your_test = unittest.make(_your_test)
+```
+
+Recall that names of test rules must end in `_test`.
+
+
+### Parameters
+
+
+
+
+
+
+
+
+ impl |
+
+ required.
+
+ The implementation function of the unit test.
+
+ |
+
+
+ attrs |
+
+ optional. default is None
+
+ An optional dictionary to supplement the attrs passed to the
+ unit test's `rule()` constructor.
+
+ |
+
+
+
+
+
+## unittest.suite
+
+
+unittest.suite(name, test_rules)
Defines a `test_suite` target that contains multiple tests.
@@ -824,7 +727,7 @@ name each target.
-
name |
required.
@@ -834,38 +737,12 @@ name each target.
|
-
test_rules |
- required.
- |
-
-
-
-
-
-## _target_actions
-
-
-_target_actions(env)
-
-
-Returns a list of actions registered by the target under test.
-
-### Parameters
-
-
-
-
-
-
-
- env)
+unittest.begin(ctx)
-Returns the target under test.
-
-### Parameters
-
-
-
-
-
-
-
- ctx)
-
+Begins a unit test.
+This should be the first function called in a unit test implementation
+function. It initializes a "test environment" that is used to collect
+assertion failures so that they can be reported and logged at the end of the
+test.
### Parameters
@@ -918,23 +772,88 @@ _unittest_toolchain_impl(ctx)
-
ctx |
required.
+
+ The Skylark context. Pass the implementation function's `ctx` argument
+ in verbatim.
+
|
-## register_unittest_toolchains
+## unittest.end
-register_unittest_toolchains()
+unittest.end(env)
-Registers the toolchains for unittest users.
+Ends a unit test and logs the results.
+
+This must be called and returned at the end of a unit test implementation function so
+that the results are reported.
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+
+
+
+## unittest.fail
+
+
+unittest.fail(env, msg)
+
+
+Unconditionally causes the current test to fail.
+
+### Parameters
+
+
+
+
+
+
+
+
+ env |
+
+ required.
+
+ The test environment returned by `unittest.begin`.
+
+ |
+
+
+ msg |
+
+ required.
+
+ The message to log describing the failure.
+
+ |
+
+
+
+
diff --git a/docs/versions_doc.md b/docs/versions_doc.md
index 7e9bc21..d94076c 100755
--- a/docs/versions_doc.md
+++ b/docs/versions_doc.md
@@ -1,170 +1,17 @@
-## _check_bazel_version
+## versions.get
-_check_bazel_version(minimum_bazel_version, maximum_bazel_version, bazel_version)
-
-
-Check that the version of Bazel is valid within the specified range.
-
-### Parameters
-
-
-
-
-
-
-
-
- maximum_bazel_version |
-
- optional. default is None
-
- maximum version of Bazel expected
-
- |
-
- bazel_version)
-
-
-Extracts the semantic version number from a version string
-
-### Parameters
-
-
-
-
-## _get_bazel_version
-
-
-_get_bazel_version()
+versions.get()
Returns the current Bazel version
-## _is_at_least
+## versions.parse
-_is_at_least(threshold, version)
-
-
-Check that a version is higher or equals to a threshold.
-
-### Parameters
-
-
-
-
-
-
-
-
- version |
-
- required.
-
- the version string to be compared to the threshold
-
- |
-
-
-
-
-
-## _is_at_most
-
-
-_is_at_most(threshold, version)
-
-
-Check that a version is lower or equals to a threshold.
-
-### Parameters
-
-
-
-
-
-
-
-
- version |
-
- required.
-
- the version string to be compared to the threshold
-
- |
-
-
-
-
-
-## _parse_bazel_version
-
-
-_parse_bazel_version(bazel_version)
+versions.parse(bazel_version)
Parses a version string into a 3-tuple of ints
@@ -180,7 +27,7 @@ int tuples can be compared directly using binary operators (<, >).
-
bazel_version |
required.
@@ -193,3 +40,126 @@ int tuples can be compared directly using binary operators (<, >).
|
+## versions.check
+
+
+versions.check(minimum_bazel_version, maximum_bazel_version, bazel_version)
+
+
+Check that the version of Bazel is valid within the specified range.
+
+### Parameters
+
+
+
+
+
+
+
+
+ minimum_bazel_version |
+
+ required.
+
+ minimum version of Bazel expected
+
+ |
+
+
+ maximum_bazel_version |
+
+ optional. default is None
+
+ maximum version of Bazel expected
+
+ |
+
+
+ bazel_version |
+
+ optional. default is None
+
+ the version of Bazel to check. Used for testing, defaults to native.bazel_version
+
+ |
+
+
+
+
+
+## versions.is_at_most
+
+
+versions.is_at_most(threshold, version)
+
+
+Check that a version is lower or equals to a threshold.
+
+### Parameters
+
+
+
+
+
+
+
+
+ threshold |
+
+ required.
+
+ the maximum version string
+
+ |
+
+
+ version |
+
+ required.
+
+ the version string to be compared to the threshold
+
+ |
+
+
+
+
+
+## versions.is_at_least
+
+
+versions.is_at_least(threshold, version)
+
+
+Check that a version is higher or equals to a threshold.
+
+### Parameters
+
+
+
+
+
+
+
+
+ threshold |
+
+ required.
+
+ the minimum version string
+
+ |
+
+
+ version |
+
+ required.
+
+ the version string to be compared to the threshold
+
+ |
+
+
+
+
+
|