exercism / rust

Exercism exercises in Rust.
https://exercism.org/tracks/rust
MIT License
1.48k stars 520 forks source link

Debugging instructions are missing #1464

Closed vitalyPru closed 11 months ago

vitalyPru commented 2 years ago

Please, consider the possibility to allow debug print during Rst tests.

github-actions[bot] commented 2 years ago

Hi and welcome to Exercism! :wave:

Thanks for opening an issue :slightly_smiling_face:

kotp commented 2 years ago

This is already possible. I do not remember how to expose this though.

But do you not have this ability when you run your tests locally?

vitalyPru commented 2 years ago

I just use only cloud version. And if I put println!() in my solution, there are no any output in test results

kotp commented 2 years ago

Yes, println() would not be expected to show in the reports for testing.

If getting serious about the language, I do encourage local development though. It gives control back to you, rather than relying on what we provide on the server.

kotp commented 2 years ago

I have sent out a "do you remember how" question in our chat. Hopefully an answer comes soon for you regarding debugging output in the tests.

vitalyPru commented 2 years ago

I found,, that debug output works for structs, which derived Debug trait. So. issue is closed.

iHiD commented 2 years ago

Does this need adding to the docs for this? @ErikSchierboom - there's a md doc for this specifically, right?

SleeplessByte commented 2 years ago

@iHiD correct, this section is missing for rust because the content is missing

image

iHiD commented 2 years ago

:+1: Reopened and transfering to Rust repo.

coriolinus commented 2 years ago

Either of the dbg! or eprintln! macros will emit to standard error, which may be captured as debug output; I'd need to double-check the test runner to see what precisely gets captured. If it is in fact captured, then the blurb should mention (and link to documentation for) each of those.

ErikSchierboom commented 2 years ago

Here are the docs for the file that should contain the debug instructions (provided it does indeed work): https://exercism.org/docs/building/tracks/shared-files#h-file-debug-md

coriolinus commented 2 years ago

It appears that the test runner sends the debug output to a file called results.out, which I believe to have been meaningful in an older version of the test runner interface.

https://github.com/exercism/rust-test-runner/blob/2e5c4cb7398aa431ccf3bb3cbc4b17fa82e1a41b/bin/run.sh#L41

Until that is updated into the current interface, I suspect that the output simply isn't being captured.

senekor commented 11 months ago

Until recently, both stdout and stderr were captured by the test runner, but they were displayed together as one big string with the error from the failed assertion of the test.

I recently updated the test runner to separate these two, for slightly improved UX. Here's my manual test:

image

I will update the documentation accordingly.