Stream: contributing

Topic: roc test, printing filenames recursively #6491


view this post on Zulip Miilyn (Mar 08 2024 at 18:04):

Hi everyone!

Im an absolute newcomer to Roc but fell in love immediately.
As a first contribution I just started trying to work on issue #6491:

it being my very first time touching the repo I eventually found my way around to
run_expects_with_memory, ToplevelExpect, ExpectFunctions, etc --
seems like this is the relevant "part of town" and I was already able to simulate a
very bare-bones version of the desired outcome using some eprintln! :)

But at this point I feel like I need some clarification on a few concepts as well as
what we're exactly going for with this feature.

view this post on Zulip Miilyn (Mar 08 2024 at 18:37):

1.) Looking at run_expects_with_memory:

for expect in expects.fx {
    let result = run_expect_fx(
        // ...
}

memory.set_shared_buffer(lib);

for expect in expects.pure {
    let result = run_expect_pure(
        // ...

1.1) What exactly does set_shared_buffer do (introduced here) ?

1.2) As a consequence, am I understanding correctly that it's imperative to run fx-tests and pure-tests separately, i.e.

view this post on Zulip Miilyn (Mar 08 2024 at 19:17):

2.) This is how @Anton sketched out the desired behaviour (#6491):

Instead of the current:

  0 failed and 2 passed in 129 ms.

This should be something like:

  main.roc:
    0 failed and 1 passed in 52 ms.
  someImportOfMain.roc:
    0 failed and 1 passed in 46 ms.

Based on assumption of having to run expect-fxs and expects separately (see 1.2):

2.1) In the case of all tests passing, achieving this output seems straightforward.
It requires collecting the number of failed/passed tests (as well as their duration)
per module -- and then printing the "summary" in test.
I've already managed to implement a basic version of this.

2.2) But ideally, the output for failing tests should be "grouped" by their modules as well.
Currently run_expect_pure / run_expect_fx
make use of render_expect_failure directly, i.e. render test failures immediately as they occur.

According to my understanding we would need make the following change:
Don't let run_expect_pure / run_expect_fx flush their failure-output directly --
but instead just "collect" their errors (if any) and postpone rendering these until test (similar to and alongside 2.1).

view this post on Zulip Jonathan Schear (Mar 08 2024 at 19:55):

Hi! I started working on this issue (I really should have commented on the github issue), and some details have been discussed in this topic: https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/Test.20discovery

I share your questions about set_shared_buffer. My approach was to run the expects for each module separately, so set_shared_buffer would be called once in between each set of expects and expects-fx. I'm planning on putting a PR up today, maybe we can collaborate on it (I'm a bit fresh to Rust so I can certainly use a code review).

view this post on Zulip Miilyn (Mar 08 2024 at 21:29):

As discussed via DM, thanks for your PR ! :heart:

hence PSA: please ignore my questions above, Im now gonna search for another issue to work on :innocent:


Last updated: Jul 06 2025 at 12:14 UTC