Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: run tests as integration test #17

Merged

Conversation

orhun
Copy link
Contributor

@orhun orhun commented Jan 1, 2024

See #18

A couple of things to note:

  1. lib.rs is created so cargo-run-bin can be used as a library.
  2. I moved the tests under tests/ which means they are now more idiomatic integration tests. See https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html
  3. We now use CARGO_BIN_EXE_cargo-bin environment variable instead of hardcoded binary path (target/debug/cargo-bin). It can be only used for integration tests - see https://doc.rust-lang.org/cargo/reference/environment-variables.html

Another thing that I wanted to do was to use another installation path instead of target/debug. The reasoning for that is I have a global target folder set up so target/debug does not exist in the project folder. I'm not sure what else we can use yet but I'm thinking of either cache or tmp. Let me know what you think!

@dustinblackman
Copy link
Owner

lib.rs is created so cargo-run-bin can be used as a library.

Love this. I hadn't expected this to be used as a library, but thinking of it now I can imagine a few use cases. I'll get the repo a tad more prepared for it on the next version.

I moved the tests under tests/ which means they are now more idiomatic integration tests. See https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html

Thanks! This was on my TODO list, just never got a chance to get to it.

We now use CARGO_BIN_EXE_cargo-bin environment variable instead of hardcoded binary path (target/debug/cargo-bin).

Much better! I can get rid of some of the Windows hacks I can put it.

@dustinblackman
Copy link
Owner

dustinblackman commented Jan 1, 2024

Another thing that I wanted to do was to use another installation path instead of target/debug.

In what scenario? For the integration tests?

EDIT: Actually I understand what you were getting at! I have changes ready in another branch I'll merge in after this one. Thanks again for the PR!

@dustinblackman dustinblackman merged commit 4c5c49a into dustinblackman:master Jan 1, 2024
4 checks passed
@orhun
Copy link
Contributor Author

orhun commented Jan 1, 2024

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants