[tests] Don't compile the test EDN into the test binary #120

Open
opened 2020-08-06 16:55:14 +00:00 by gburd · 0 comments
gburd commented 2020-08-06 16:55:14 +00:00 (Migrated from github.com)

Right now, I'm using include_str! to get the EDN fixtures into our tests. However, this means any change to the test data prompts a recompile, which is slow!

This ticket tracks updating the code around 9be487ca7d/db/src/db.rs (L921) and 9be487ca7d/db/src/db.rs (L943) to instead only include_str! a single file listing the test fixture filenames, and then dynamically reading the test fixture contents at test time.

That'll make changes to the test list prompt a recompile, but otherwise make it fast to iterate on the test file itself.

Bonus points for using a build.rs snippet to expand the test list at compile time, generating functions for reach test file. That will produce better cargo test output than a single test that runs through all the test fixtures.

Right now, I'm using [include_str!](https://doc.rust-lang.org/1.6.0/std/macro.include_str!.html) to get the EDN fixtures into our tests. However, this means any change to the test data prompts a recompile, which is slow! This ticket tracks updating the code around https://github.com/mozilla/mentat/blob/9be487ca7d84416f71c8c77361c9483f7bccc88f/db/src/db.rs#L921 and https://github.com/mozilla/mentat/blob/9be487ca7d84416f71c8c77361c9483f7bccc88f/db/src/db.rs#L943 to instead only `include_str!` a _single_ file listing the test fixture filenames, and then dynamically reading the test fixture contents at test time. That'll make changes to the test list prompt a recompile, but otherwise make it fast to iterate on the test file itself. Bonus points for using a `build.rs` snippet to expand the test list at compile time, generating functions for reach test file. That will produce better `cargo test` output than a single test that runs through all the test fixtures.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/mentat#120
No description provided.