opt_level: uint,
debug: bool,
test: bool,
+ doctest: bool,
doc: bool,
dest: Option<String>,
plugin: bool,
doc: false,
dest: None,
plugin: false,
+ doctest: false,
}
}
env: "compile".to_string(), // run in the default environment only
opt_level: 0,
debug: true,
- test: false, // whether or not to pass --test
- dest: None,
- plugin: false,
- doc: false,
+ .. Profile::default()
}
}
self.test
}
+ pub fn is_doctest(&self) -> bool {
+ self.doctest
+ }
+
pub fn is_plugin(&self) -> bool {
self.plugin
}
self
}
+ pub fn doctest(mut self, doctest: bool) -> Profile {
+ self.doctest = doctest;
+ self
+ }
+
pub fn doc(mut self, doc: bool) -> Profile {
self.doc = doc;
self
}
let mut libs = package.get_targets().iter().filter_map(|target| {
- if !target.get_profile().is_test() || !target.is_lib() {
+ if !target.get_profile().is_doctest() || !target.is_lib() {
return None
}
Some((target.get_src_path(), target.get_name()))
layout.lib.as_ref().map(|lib| {
vec![TomlTarget {
name: name.to_string(),
- crate_type: None,
path: Some(TomlPath(lib.clone())),
- test: None,
- plugin: None,
- doc: None,
+ .. TomlTarget::new()
}]
}).unwrap_or(Vec::new())
}
name.map(|name| {
TomlTarget {
name: name,
- crate_type: None,
path: Some(TomlPath(bin.clone())),
- test: None,
- plugin: None,
- doc: None,
+ .. TomlTarget::new()
}
})
}).collect()
ex.filestem_str().map(|name| {
TomlTarget {
name: name.to_string(),
- crate_type: None,
path: Some(TomlPath(ex.clone())),
- test: None,
- plugin: None,
- doc: None,
+ .. TomlTarget::new()
}
})
}).collect()
ex.filestem_str().map(|name| {
TomlTarget {
name: name.to_string(),
- crate_type: None,
path: Some(TomlPath(ex.clone())),
- test: None,
- plugin: None,
- doc: None,
+ .. TomlTarget::new()
}
})
}).collect()
self.lib.get_ref().iter().map(|t| {
if layout.lib.is_some() && t.path.is_none() {
TomlTarget {
- name: t.name.clone(),
- crate_type: t.crate_type.clone(),
path: layout.lib.as_ref().map(|p| TomlPath(p.clone())),
- test: t.test,
- plugin: t.plugin,
- doc: t.doc,
+ .. t.clone()
}
} else {
t.clone()
self.bin.get_ref().iter().map(|t| {
if bin.is_some() && t.path.is_none() {
TomlTarget {
- name: t.name.clone(),
- crate_type: t.crate_type.clone(),
path: bin.as_ref().map(|&p| TomlPath(p.clone())),
- test: t.test,
- plugin: None,
- doc: t.doc,
+ .. t.clone()
}
} else {
t.clone()
crate_type: Option<Vec<String>>,
path: Option<TomlPath>,
test: Option<bool>,
+ doctest: Option<bool>,
doc: Option<bool>,
plugin: Option<bool>,
}
TomlPath(Path),
}
+impl TomlTarget {
+ fn new() -> TomlTarget {
+ TomlTarget {
+ name: String::new(),
+ crate_type: None,
+ path: None,
+ test: None,
+ doctest: None,
+ doc: None,
+ plugin: None,
+ }
+ }
+}
+
impl TomlPath {
fn to_path(&self) -> Path {
match *self {
Some(false) => {}
}
+ let doctest = target.doctest.unwrap_or(true);
match target.doc {
- Some(true) | None => ret.push(Profile::default_doc()),
+ Some(true) | None => {
+ ret.push(Profile::default_doc().doctest(doctest));
+ }
Some(false) => {}
}
[dependencies.foo]
path = "../foo"
+
+ [[lib]]
+ name = "bar"
+ doctest = false
"#)
.file("src/lib.rs", "
extern crate foo;
running 1 test
test bar_test ... ok
-test result: ok. 1 passed; 0 failed; 0 ignored; 0 measure
-
-{doctest} bar
-
-running 0 tests
-
-test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured\n\n\
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\
",
compiling = COMPILING, running = RUNNING,
- doctest = DOCTEST,
dir = p.url()).as_slice()));
})
[[lib]]
name = "syntax"
test = false
+ doctest = false
"#)
.file("src/lib.rs", "
pub fn foo() {}