Skip to content

Allow for return types#4

Merged
Y-Nak merged 3 commits intofe-lang:mainfrom
dzfrias:return-types
Mar 2, 2024
Merged

Allow for return types#4
Y-Nak merged 3 commits intofe-lang:mainfrom
dzfrias:return-types

Conversation

@dzfrias
Copy link
Contributor

@dzfrias dzfrias commented Feb 14, 2024

Thanks for the great crate! This PR allows return types in test functions (namely for Result<T>).

Copy link
Collaborator

@Y-Nak Y-Nak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! The change looks good to me.
Would you modify a doc comment in dir-test/src/lib.rs so users can know this nice feature?

@Y-Nak
Copy link
Collaborator

Y-Nak commented Mar 2, 2024

Oh, no. I just remembered that rust doesn't allow the return type in the #[test] function.
Would you share the use case for it? We could easily extend this crate to generate a normal function which one-to-one corresponds to a file.

@dzfrias
Copy link
Contributor Author

dzfrias commented Mar 2, 2024

Rust allows for the Result type to be used in the return type of a test: link here. If the change is still okay, I'll add that doc comment!

@Y-Nak
Copy link
Collaborator

Y-Nak commented Mar 2, 2024

Ah, I'm embarrassed! I didn't know it's just required to implement std::process::Termination for the return type.

Alright, your change looks good to me! Thanks!

@dzfrias
Copy link
Contributor Author

dzfrias commented Mar 2, 2024

Okay, I added the relevant documentation!

@Y-Nak Y-Nak merged commit dceb0e4 into fe-lang:main Mar 2, 2024
@Y-Nak
Copy link
Collaborator

Y-Nak commented Mar 2, 2024

Thank you! I'll bump up the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants