Unit testing action arguments?

Skip to first unread message


Nov 14, 2022, 5:24:27 AM11/14/22
to bazel-discuss
I am writing unit tests of some custom rules by using Skylib unittest.bzl (https://bazel.build/rules/testing). I want to verify that actions contain expected options, but fail to convert the action arguments to a string.

Rule actions are of type Args. It only has functions for adding arguments. str(args) and repr(args) just return "context.args() object". print(args) do print the full command to the debug log. According to the documentation of print the string conversion it uses "is unspecified and may change at any time. In particular, it may be different from (and more detailed than) the formatting done by str() and repr()", which seems to be the case here.

How do you convert Args to a string in Starlark?
Reply all
Reply to author
0 new messages