You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo expand should be able to expand the code of a test file somename.rs in the tests directory of a given crate via --test somename even though somename.rs exists but "somename" is not part of the test targets listed for the given crate by cargo-metadata.
Technical Details
The expansion should be done in a similar way as the trybuild crate handles building and testing of its tests:
pull out the code under test (e.g. our somename.rs) into a temp. directory
run rustc against that
just like trybuild would
using --pretty=expanded instead of building or testing anything
The text was updated successfully, but these errors were encountered:
#[test]fntests(){let t = trybuild::TestCases::new();
t.pass("examples/01-parse.rs");//t.pass("examples/02-create-builder.rs");//t.pass("examples/03-call-setters.rs");//t.pass("examples/04-call-build.rs");//t.pass("examples/05-method-chaining.rs");//t.pass("examples/06-optional-field.rs");//t.pass("examples/07-repeated-field.rs");//t.compile_fail("examples/08-unrecognized-attribute.rs");//t.pass("examples/09-redefined-prelude-types.rs");}
Execute cargo expand --example 01-parse. We can expand examples/01-parse.rs. We can also test the lib with cargo test --tests.
Original idea: dtolnay/trybuild#35
Suggested approach: dtolnay/trybuild#35 (comment)
Solution Summary
cargo expand
should be able to expand the code of a test filesomename.rs
in thetests
directory of a given crate via--test somename
even thoughsomename.rs
exists but"somename"
is not part of the test targets listed for the given crate bycargo-metadata
.Technical Details
The expansion should be done in a similar way as the
trybuild
crate handles building and testing of its tests:somename.rs
) into a temp. directoryrustc
against thattrybuild
would--pretty=expanded
instead of building or testing anythingThe text was updated successfully, but these errors were encountered: