rust icon indicating copy to clipboard operation
rust copied to clipboard

Debugging instructions are missing

Open vitalyPru opened this issue 3 years ago • 12 comments

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

vitalyPru avatar Mar 03 '22 07:03 vitalyPru

Hi and welcome to Exercism! :wave:

Thanks for opening an issue :slightly_smiling_face:

  • If you are suggesting a new feature or an improvement to Exercism, please take a read of this post, which will likely result in a faster response.
  • If you are reporting a bug in the website, thank you! We are getting a lot of reports at the moment (which is great), but we triage and reply as soon as we can.
  • If you are requesting support, someone will help shortly.
  • For everything else, we will reply or triage your issue to the right repository soon.

github-actions[bot] avatar Mar 03 '22 07:03 github-actions[bot]

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?

kotp avatar Mar 03 '22 10:03 kotp

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

vitalyPru avatar Mar 03 '22 11:03 vitalyPru

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 avatar Mar 03 '22 11:03 kotp

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.

kotp avatar Mar 03 '22 11:03 kotp

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

vitalyPru avatar Mar 03 '22 21:03 vitalyPru

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

iHiD avatar Mar 04 '22 14:03 iHiD

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

image

SleeplessByte avatar Mar 04 '22 16:03 SleeplessByte

:+1: Reopened and transfering to Rust repo.

iHiD avatar Mar 04 '22 18:03 iHiD

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.

coriolinus avatar Mar 04 '22 18:03 coriolinus

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

ErikSchierboom avatar Mar 07 '22 19:03 ErikSchierboom

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.

coriolinus avatar Mar 08 '22 17:03 coriolinus

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.

senekor avatar Dec 14 '23 22:12 senekor