stalwartlabs/mail-auth

test feature

djc opened this issue · 1 comments

djc commented

The design in 4383fcc seems a little surprising. What is the test feature intended to do? Is there a reason not to use #[cfg(test)] directly? It seems kinda strange that running the tests requires the test feature (otherwise a bunch of tests fail). Usually Cargo features should be additive, such that code compiles (and passes tests) whether the feature is enabled or not.

The test feature enables the mock resolver and disables all DNS lookups. I needed to be able to use this feature from outside the library but cargo does not yet support automatically enabling features when running cargo test. Anyway, I fixed it with the following workaround:

#[cfg(any(test, feature = "test"))]