Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Access to functional subroutine return values in tests #288

Open
1 task done
richardmarshall opened this issue Apr 1, 2024 · 1 comment
Open
1 task done
Labels
feature request The issue could be reproduced good first issue Good for newcomers help wanted Extra attention is needed

Comments

@richardmarshall
Copy link
Collaborator

Kind of proposals

  • Testing

Describe the feature

When testing user defined functions that return values there is no direct way to access the return value in a test. Like testing.state it would be nice to have another testing variable containing the return value of the previous function call.

The idea is to be able to have a test written along the lines of:

sub test {
    testing.call_subroutine("returns_a_string");
    assert.equal(testing.return_value, "hi!");
}

Give us your considerations

testing.call_subroutine could be updated to store the return value of function subroutines along the lines of how it is storing state transitions in ctx.ReturnState. With that value stored in the context a new testing.return_value testing variable could be added to give tests access to this value.

@richardmarshall richardmarshall added help wanted Extra attention is needed good first issue Good for newcomers feature request The issue could be reproduced labels Apr 1, 2024
@gandazgul
Copy link

I'm working on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request The issue could be reproduced good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants