Closed vtsao closed 1 year ago
@adonovan not sure where the best place is to add a test for this? It doesn't look like any of the other starlark.Function
methods have tests.
@adonovan not sure where the best place is to add a test for this? It doesn't look like any of the other
starlark.Function
methods have tests.
Yeah, there isn't much there yet. See the TODO in testdata/function.star:
# TODO(adonovan):
# - add some introspection functions for looking at function values
# and test that functions have correct position, free vars, names of locals, etc.
If you're feeling diligent, you could add a built-in function following the paradigm of hasFields or struct that returns a dict of function attributes (e.g. name, pos, defaults) and then write assertions in Starlark. But if you don't feel like it that's fine too.
If you're feeling diligent, you could add a built-in function following the paradigm of hasFields or struct that returns a dict of function attributes (e.g. name, pos, defaults) and then write assertions in Starlark. But if you don't feel like it that's fine too.
I added a test in value_test.go
for this that I think is more direct as it tests ParamDefault()
directly. Hope this is okay, even though it's a bit different than the other tests.
@adonovan friendly ping - how does this all look?
Hey @adonovan, following up again - any chance we can get this merged? Let me know if you'd like to see anything else in this PR. Thanks!
450