Stream: contributing

Topic: roc test, testing multiple roc files


view this post on Zulip Matheus Ashton (Mar 06 2024 at 03:37):

Hi! I'm a beginner in roc contribution :sweat_smile: I'm trying to work in #5103 adding the possibility to pass multiple roc files as arguments to the test subcommand.
Disclaimer: I do not have so much experience with Rust and also it's my first time contributing to a programming language internals.

I figured out that we handle the test command here.

A simple solution would be to configure the ROC_FILE arg to use the ArgAction::Append to allow multiple values as input, and then iterate over them calling the test function for each one.

This is the most basic (and maybe naive) approach, it could have some performance issues, I don't know exactly if we have a better way to handle this at Rust, I'm sure that we could do something to run the tests in parallel, but is this a design that we want to have by default? Should we run the files sequentially and maybe provide another flag to enable them to run in parallel?

Any suggestions or guidelines that I should follow?

view this post on Zulip Anton (Mar 06 2024 at 10:39):

Thanks for contributing @Matheus Ashton :)

I would use DIRECTORY_OR_FILES like we did in CMD_FORMAT here and I would modify pub fn test(matches: &ArgMatches, triple: Triple) -> ... to pub fn test(roc_file: PathBuf, triple: Triple) -> ...

view this post on Zulip Matheus Ashton (Mar 06 2024 at 13:54):

Nice! Thank you! I assume that receiving a PathBuf you're suggesting iterating through the matches like I mentioned earlier, what about the performance issue ?

view this post on Zulip Anton (Mar 06 2024 at 14:27):

what about the performance issue ?

Oh yeah, sorry, I would not use any parallelism. We can add that when it's needed.


Last updated: Jul 06 2025 at 12:14 UTC