aboutsummaryrefslogtreecommitdiffhomepage
path: root/WORKSPACE
diff options
context:
space:
mode:
authorGravatar mstaib <mstaib@google.com>2017-07-19 21:50:20 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-07-20 10:29:13 +0200
commit2cb56d53efb3964f1bd3ab3cb19f43ae7a2fdce0 (patch)
treea3fd9cbdf4ae538ccef5bd34c36c4fdf64bed7b9 /WORKSPACE
parentd1e564bbe72c9de5f22e5b6dc8af26ce7520bbc8 (diff)
Add test framework for OptionsBase classes and their Converters.
Because OptionsBase implements equals() as a final method, subclasses can only add fields in certain ways for OptionsBase to properly obey equals() semantics. Specifically, all fields must be public and @Option annotated. The OptionsTester checks for these two things. Additionally, Converters must make sure to always return equals() values on equals() (or equivalent) input. The OptionsTester includes a check that all Converters named by the OptionsBase subclass being tested have matching ConverterTesters, and if valid default values are specified (i.e., on Options which are not multi-valued or default null), that these defaults are among the values tested by the ConverterTesters. The ConverterTesters themselves are wrapped EqualsTesters, testing that the output of a Converter obeys equals() as expected for the same input (or equivalent ones), and is consistent across calls to the same Converter instance or different Converter instances. Between these two, OptionsBase subclasses can have reasonable certainty that two instances of themselves which were parsed equally - or underwent equivalent transformations - will be equal. This does not actually test any OptionsBase subclasses or Converter implementations; it merely adds a framework. Future changes will cover automatically testing all of the OptionsBase subclasses in a RuleClassProvider, but naturally, this requires writing test data for each Converter in the Bazel codebase first. RELNOTES: None. PiperOrigin-RevId: 162522445
Diffstat (limited to 'WORKSPACE')
0 files changed, 0 insertions, 0 deletions