-
Notifications
You must be signed in to change notification settings - Fork 44
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
Figure out a way to not require skeptic for users of a crate using skeptic #60
Comments
Hi, Indeed, skeptic is built on top of few hacks glued together as there is no way to hook onto the test harness other than writing an actual rs file containing tests into some directory recognized by cargo. Also I am waiting for build plans to land in order not to be able to hook into cargo smarts about dependency resolution and compilation. At this moment I see not way to fix these issues but I'm open to ideas! |
One way that I'm pretty sure could be made to work currently would be to use macros 1.1 as a hack for procedural macros, something like: #[cfg(test)]
mod test {
#[macro_use]
extern crate skeptic_derive;
#[derive(Skeptic)]
#[skeptic_files = "README.md, docs/foo.md"]
struct SkepticTests;
} Obviously it'd be nicer to have real procedural macro support so it could look more like: #[cfg(test)]
mod test {
#[macro_use]
extern crate skeptic;
add_skeptic_tests!["README.md", "docs/foo.md"];
} |
Hmm neat idea @luser! I would really welcome a PR or a partial POC if you would be willing to contribute some of your time. |
Annoyingly, this issue caused me to switch off skeptic for https://github.com/asajeffrey/swapper/ since it was dragging skeptic and all its dependencies into servo. |
@asajeffrey That's sad to read but reasonable. This is probably the biggest problem with skeptic today. If you have any thoughts on the matter I'd be glad to read them. |
@budziq yes, I was quite grumpy. The blocker was asajeffrey/swapper#3 (comment)
|
@luser's workaround means one cannot avoid a rebuild when running |
@nox suggests a solution, which is to have a separate cargo command for running skeptic: https://mozilla.logbot.info/servo/20171108#c13824351 |
Hi @nox, @asajeffrey, Sorry for taking so long to respond. rustdoc ./README.md --test -L ./target/debug/deps/ As far as I know these should be more or less equivalent except for:
I'm inclined to follow @luser's suggestion once I carve enough free time to actually play with Macros 1.1. This should make the lib slightly less painful to use. If you see a clear advantage of |
@budziq yes, I ended up just running rustdoc directly, e.g. https://github.com/asajeffrey/josephine/blob/e6a385af2ac2f83a2af21b634b840cd95de17662/.travis.yml#L15. The lack of .skt is a bit annoying, but it does the job! |
I liked @asajeffrey's suggestion so I tried out integrating it as a Rust test so that it'd run as part of It seems to work reasonably well! It would be neat to figure out if that could be written as a macro so it could be encapsulated into some sort of |
Should fix #16. See also budziq/rust-skeptic#60.
Should fix #16. See also budziq/rust-skeptic#60.
Markdown parsers and more are foited onto clients because of Skeptic. This is inspired by the conversation at budziq/rust-skeptic#60 regarding a "skeptic-lite" using rustdoc.
Markdown parsers and more are foited onto clients because of Skeptic. This is inspired by the conversation at budziq/rust-skeptic#60 regarding a "skeptic-lite" using rustdoc. Apparently, the stable version of rustdoc needs newlines between the preceding paragraph and the code-block. See rust-lang/rust#48068.
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
…calls Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
Unfortunately skeptic pulls all its dependencies in projects using lettre (see budziq/rust-skeptic#60).
While I know skeptic can be replaced with as little as https://github.com/assert-rs/docmatic I see some people have been adding |
Similar to skpetic, but it does not add itself as a build dependency, which means that all downstream users of LZ4 don't need to build skeptic (and all its dependencies). See budziq/rust-skeptic#60.
So I'm not looking at this from the angle of integrating into a CI (test reporting, coverage, etc). So far we've been creating replacements for |
Using skeptic from build.rs and having it in
build-dependencies
means that everyone using a crate that uses skeptic winds up building skeptic and all of its dependencies, which adds build time and provides no real value to the end user. It would be nice to figure out a way to only require skeptic when building tests for a crate.One way to support this would be if cargo added a way to run build scripts for tests. Another way would be for skeptic to be implemented as a procedural macro that could be invoked from inside a
#[cfg(test)]
block.The text was updated successfully, but these errors were encountered: