Fixup testst

This commit is contained in:
Graham Christensen 2018-01-21 18:00:42 -05:00
parent 73ac0527ee
commit b80eb71f67
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 14 additions and 2 deletions

View file

@ -37,7 +37,13 @@ pub fn parse_line(text: &str) -> Option<Vec<Instruction>> {
for command in commands { for command in commands {
let (left, right) = command.split_at(1); let (left, right) = command.split_at(1);
match left[0].as_ref() { match left[0].as_ref() {
"build" => instructions.push(Instruction::Build(Subset::Nixpkgs, right.to_vec())), "build" => {
let attrs = right.to_vec();
if attrs.len() > 0 {
instructions.push(Instruction::Build(Subset::Nixpkgs, attrs));
}
}
"test" => { "test" => {
instructions.push(Instruction::Build( instructions.push(Instruction::Build(
Subset::NixOS, Subset::NixOS,
@ -94,6 +100,11 @@ mod tests {
assert_eq!(None, parse(":) :) :) @grahamcofborg build hi")); assert_eq!(None, parse(":) :) :) @grahamcofborg build hi"));
} }
#[test]
fn bogus_build_comment_empty_list() {
assert_eq!(None, parse("@grahamcofborg build"));
}
#[test] #[test]
fn eval_comment() { fn eval_comment() {
assert_eq!(Some(vec![Instruction::Eval]), parse("@grahamcofborg eval")); assert_eq!(Some(vec![Instruction::Eval]), parse("@grahamcofborg eval"));

View file

@ -402,7 +402,8 @@ mod tests {
owner: "ofborg-test".to_owned(), owner: "ofborg-test".to_owned(),
}, },
subset: None, subset: None,
logs: Some((String::from("logs"), String::from("build.log"))), logs: Some((Some(String::from("logs")), Some(String::from("build.log")))),
statusreport: Some((Some(String::from("build-results")), None)),
}; };
let mut dummyreceiver = notifyworker::DummyNotificationReceiver::new(); let mut dummyreceiver = notifyworker::DummyNotificationReceiver::new();