Skip to content

Commit b808eab

Browse files
committed
rustc: Generate test code when in the 'test' config
1 parent 28c7a25 commit b808eab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustc/front/test.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ type test_ctxt =
2929
fn modify_for_testing(sess: session::Session,
3030
crate: @ast::crate) -> @ast::crate {
3131

32-
if sess.opts.test {
32+
// We generate the test harness when building in the 'test'
33+
// configuration, either with the '--test' or '--cfg test'
34+
// command line options.
35+
let should_test = attr::contains(crate.node.config,
36+
attr::mk_word_item(~"test"));
37+
38+
if should_test {
3339
generate_test_harness(sess, crate)
3440
} else {
3541
strip_test_functions(crate)

0 commit comments

Comments
 (0)