rustpkg: Factor out tests; use a condition instead of returning an option
Pulled out tests into their own modules inside the files they test, as per the draft style guidelines. Started a new module, path_util, for utility functions to do with paths and directories. Changed default_dest_dir to use a condition and return Path instead of Option<Path>.
This commit is contained in:
parent
74fee15bc1
commit
884c7c9326
5 changed files with 137 additions and 62 deletions
|
@ -563,21 +563,26 @@ pub fn link_exe(src: &Path, dest: &Path) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_cmd() {
|
||||
assert!(is_cmd(~"build"));
|
||||
assert!(is_cmd(~"clean"));
|
||||
assert!(is_cmd(~"do"));
|
||||
assert!(is_cmd(~"info"));
|
||||
assert!(is_cmd(~"install"));
|
||||
assert!(is_cmd(~"prefer"));
|
||||
assert!(is_cmd(~"test"));
|
||||
assert!(is_cmd(~"uninstall"));
|
||||
assert!(is_cmd(~"unprefer"));
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{is_cmd, parse_name};
|
||||
|
||||
#[test]
|
||||
fn test_parse_name() {
|
||||
assert!(parse_name(~"org.mozilla.servo").get() == ~"servo");
|
||||
assert!(parse_name(~"org. mozilla.servo 2131").is_err());
|
||||
#[test]
|
||||
fn test_is_cmd() {
|
||||
assert!(is_cmd(~"build"));
|
||||
assert!(is_cmd(~"clean"));
|
||||
assert!(is_cmd(~"do"));
|
||||
assert!(is_cmd(~"info"));
|
||||
assert!(is_cmd(~"install"));
|
||||
assert!(is_cmd(~"prefer"));
|
||||
assert!(is_cmd(~"test"));
|
||||
assert!(is_cmd(~"uninstall"));
|
||||
assert!(is_cmd(~"unprefer"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_name() {
|
||||
assert!(parse_name(~"org.mozilla.servo").get() == ~"servo");
|
||||
assert!(parse_name(~"org. mozilla.servo 2131").is_err());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue