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 {
let (left, right) = command.split_at(1);
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" => {
instructions.push(Instruction::Build(
Subset::NixOS,
@ -94,6 +100,11 @@ mod tests {
assert_eq!(None, parse(":) :) :) @grahamcofborg build hi"));
}
#[test]
fn bogus_build_comment_empty_list() {
assert_eq!(None, parse("@grahamcofborg build"));
}
#[test]
fn eval_comment() {
assert_eq!(Some(vec![Instruction::Eval]), parse("@grahamcofborg eval"));

View file

@ -402,7 +402,8 @@ mod tests {
owner: "ofborg-test".to_owned(),
},
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();