Skip to content

Allow for return types#4

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

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

Conversation

@dzfrias

@dzfrias dzfrias commented Feb 14, 2024

Copy link
Copy Markdown
Contributor

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

@Y-Nak Y-Nak left a comment

Copy link
Copy Markdown
Collaborator

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

Y-Nak commented Mar 2, 2024

Copy link
Copy Markdown
Collaborator

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

dzfrias commented Mar 2, 2024

Copy link
Copy Markdown
Contributor Author

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

Y-Nak commented Mar 2, 2024

Copy link
Copy Markdown
Collaborator

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

dzfrias commented Mar 2, 2024

Copy link
Copy Markdown
Contributor Author

Okay, I added the relevant documentation!

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

Y-Nak commented Mar 2, 2024

Copy link
Copy Markdown
Collaborator

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