TargetSubject.provider()andTargetSubject.has_provider()accept aprovider_namefor better error messaging.- Added
FileSubject.basename()andFileSubject.actual - The
testing_aspectis applied toutil.force_exec_config'stoolsattribute allowing tests to assert on it like a regular target-under-test - Added
ActionSubject.meta, exposing the subject'sExpectMetaobject. - Added
CollectionSubject.contains_no_duplicates()assertion. - Added
DepsetFileSubject.contains_none_of()assertion. - Added
not_containsto StrSubject.
- Nothing yet
0.8.0 - 2025-03-17
- Add
{bindir}to formatting variables. - Format values in
ActionsSubject.contains_flag_values(). CollectionSubjectaccepts new constructor parameterformat. When used all asserts are formatted.Actionsubjects.argv()formats all asserts, for exampleaction.argv().contains_at_least(["-f", "{bindir}/{package}/input.txt"]).
- Added support for testing actions created in an aspect, via
util.make_testing_aspectandanalysis_test'stesting_aspectparameter.
- Removed
util.recursive_testing_aspectandanalysis_test.collect_actions_recursively. They were never properly implemented.
0.7.0 - 2024-10-29
matching.any()andmatching.all()for composingMatcherobjects using "or" and "and" semantics, respectively- Predicate-variants for RunfilesSubject methods:
RunfilesSubject.contains_exactly_predicates(),RunfilesSubject.contains_at_least_predicates() RunfilesSubject.paths(), which returns aCollectionSubjectof the runfiles paths.
analysis_testnow only accepts keyword args. This is to enforce the convention that rules (or rule-like macros) have everything passed as keyword args.
- Custom target under test attributes. These are like regular custom attributes, except they can also have their config settings changed and they have the usual target under test aspects applied. This allows testing multiple targets in one test with a mixture of configurations. (#67)
analysis_testnow takes the parameterprovider_subject_factories. If you want to perform assertions on custom providers, you no longer need to use the factory parameter each time you want to retrieve the provider. instead, you now writeanalysis_test(..., provider_subject_factories = [ type = FooInfo, name = "FooInfo", factory = FooSubjectFactory]).- Add
env.expect.that_value(Foo(...), factory=FooSubjectFactory). This allows you to do expectations on an arbitrary value of any type.
0.5.0 - 2023-10-04
- DefaultInfoSubject for asserting the builtin DefaultInfo provider (#52)
- CollectionSubject now supports tuples. (#69)
0.4.0 - 2023-07-10
- Common attributes, such as
tagsandtarget_compatible_withcan now be set on tests themselves. This allows skipping tests based on platform or filtering out tests using--test_tag_filters(#43) - StructSubject for asserting arbitrary structs. (#53)
- (docs) Created human-friendly changelog
0.3.0 - 2023-07-06
- Publically exposed subjects in
truth.bzl#subjects. This allows direct creation of subjects without having to go through theexpect.that_*functions. This makes it easier to implement custom subjects. (#54) matching.file_basename_equalsfor matching a File basename. (#44)matching.file_extension_infor matching a File extension. (#44)DictSubject.getfor fetching sub-values within a dict as subjects. (#51)CollectionSubject.transformfor arbitrary transforming and filtering of a collection. (#45)
0.2.0 - 2023-06-14
- Unit-test style tests. These are tests that don't require a "setup" phase like analysis tests do, so all you need to write is the implementation function that does asserts. (#37)
- (docs) Document some best practices for test naming and structure.
//lib:analysis_test.bzl#test_suite: use//lib:test_suite.bzl#test_suiteinstead. The name inanalysis_test.bzlwill be removed in a future release.
0.1.0 - 2023-05-02
- Don't require downstream user to register Python toolchains. (#33)
0.0.5 - 2023-04-25
NOTE: This version is broken with bzlmod
- Fix crash when equal collections with differing orders have
in_order()checked. (#29)
- Generated docs with API reference at https://rules-testing.readthedocs.io (#28)