helgoboss / reaper-rs

Rust bindings for the REAPER C++ API
MIT License
82 stars 8 forks source link

Can not make integration test fail. #65

Open Levitanus opened 2 years ago

Levitanus commented 2 years ago

I'm working on MIDI functions, and can not make integration test fail by assert! macros.

If I'm directly using panic! it fails, but with literally wrong assert_eq!("one string", "another string"); it continues to show everything is fine.

You can see my test function at commit(https://github.com/Levitanus/reaper-rs/commit/8830e33c5f8875cc7d786f9febcaa50dc64e579f).

What am I doing wrong?

P.S. I'm interested, why Project struct takes &Track as reference in method delete_track(track)? Maybe it's better to consume it?

helgoboss commented 2 years ago

I'm working on MIDI functions, and can not make integration test fail by assert! macros.

If I'm directly using panic! it fails, but with literally wrong assert_eq!("one string", "another string"); it continues to show everything is fine.

You can see my test function at commit(Levitanus@8830e33).

What am I doing wrong?

Mmh, I don't see the mistake at the moment. Didn't try your code. Are you sure you executed this and not something else? I just tried to put your assert_eq at the top of the solo_track step and that made the test fail:

  1. Solo track β†’ FAILED

Expression "ahhh!"

"ahhh!"

was expected to be equal to expression "Not!"

"Not!"

P.S. I'm interested, why Project struct takes &Track as reference in method delete_track(track)? Maybe it's better to consume it?

In general, the high-level API is not something that I made with extra care. I want to rewrite it from scratch at some point. In that case, are you talking about the semantics? Like, "deleting" should not make it usable anymore? Could be nice, will think about it for the great rewrite :)

Levitanus commented 2 years ago

Are you sure you executed this and not something else?

If I panic right after the assert, it fails, so, probably, it walks through the code, but I've done something wrong...

Sorry, I'll return to the project tomorrow evening, we have a concert tomorrow)

P.S. Honestly, I really miss the major part of API) Writing in rust for a couple of weeks already brought many positive additions to the architecture of my new project. In part, that are not connected with Reaper. But we've built reapy for more than 3 years, and I miss it so much. There I've known every line of code, and we've made it very expressive and comfortable to use))

So, I'm thinking of freezing everything I'm doing in free time and cover as much as possible. I'll carefully check that PR's tomorrow. And I want to also make the testing process clear for me :)

Thanks!

Levitanus commented 2 years ago

I've got the problem: before running cargo test, cargo build --workspace should be invoked πŸ™‚

Maybe the testing in brief should be considered in docs for... Medium API?

And anything you feel important ☺️

P.S. If You consider issue resolved β€” feel free to close)

Levitanus commented 2 years ago

Actually, I liked how you've managed integration test! It would be awesome to have something similar as crate. For the moment by myself I've made only a couple of assert functions, which I use to run through all "steps" and log results.