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

Migrate doc tests to use macros 1.1 #576

Closed
killercup opened this Issue Jan 13, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@killercup
Member

killercup commented Jan 13, 2017

Since macros 1.1 is the way to use diesel from 0.10/rust 1.15 forward, we should migrate to using custom derives in our API documentation, instead of the macros. This will introduce a (dev) dependency on diesel_codegen, but in general it shouldn't be a problem.

With a quick rg '///(.*?)impl_(\w+)!' -g '!src/macros' I could only find 4 usages of the impl_* macros.

@dstu

This comment has been minimized.

Contributor

dstu commented Jan 14, 2017

What do you recommend doing to ensure that doctests are working properly? What is the best way to run modified doctests to ensure that they work properly? cargo test, bin/test, or something else?

@killercup

This comment has been minimized.

Member

killercup commented Jan 14, 2017

Good question, @dstu! I'm a lazy person, so I don't want to wait for all the tests to run! :) When I added the doc test to #561, I used:

$ pwd # in diesel crate dir
…/diesel/diesel
$ env RUST_BACKTRACE=1 DATABASE_URL=postgresql://pascal@localhost/diesel_test DATABASE_URL_FOR_SCHEMA=postgresql://pascal@localhost/diesel_schema cargo +nightly test --no-default-features --features "postgres serde_json unstable" -- Jsonb

The important parts are the features, and the -- <whatever> after the cargo test arguments, as that tells the test runner to only execute the tests whose names contain the <whatever>.

If you are happy with your changes and your new/changed tests run, you can run the whole test suite. Or, you know, let Travis to it when you open a PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment