Tuckr icon indicating copy to clipboard operation
Tuckr copied to clipboard

We should probably have some proper end-to-end tests

Open MaddyGuthridge opened this issue 2 months ago • 2 comments

While looking through Tuckr's codebase, I noticed there were very few tests, and there were a few hacks to get testing to work, especially in regards to environment variable fiddling, and even some thread-y hacks.

Testing Tuckr would probably be much simpler and more reliable if we had some end-to-end tests which actually run the compiled executable (preferably in an isolated way to prevent it from breaking systems). I haven't done that sort of thing for any meaningful rust project before, but if you point me towards a preferred framework (I imagine cargo test may not be ideal for end-to-end tests), I'm happy to try writing some.

We should probably also get the tests running in CI to make sure we don't accidentally break stuff.

MaddyGuthridge avatar Sep 20 '25 13:09 MaddyGuthridge

yeah, guilty as charged 💀 For that sort of thing I think what you want is integration tests. It's "kinda" what I'm doing by calling the *_cmd functions like a user would. A few of the tests there are also just to ensure that I'm computing the right things. Other things I don't have tests for them just because they were too much work to maintain.

I do run the tests myself on my machine, but I've been the only active contributors for a long time, so I never felt the need for it. If you find a better way to do this, I'm willing to accept it.

RaphGL avatar Sep 20 '25 13:09 RaphGL

Note to self: https://crates.io/crates/assert_fs

MaddyGuthridge avatar Sep 24 '25 14:09 MaddyGuthridge