Add the test command
This commit is contained in:
parent
53308f057b
commit
20c4d2a302
14
README.md
14
README.md
|
@ -20,6 +20,20 @@ Commands:
|
|||
@grahamcofborg build list of attrs
|
||||
```
|
||||
|
||||
This will run `nix-build ./default.nix -A list -A of -A attrs` in
|
||||
the nixpkgs checkout.
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
@grahamcofborg test list of tests
|
||||
```
|
||||
|
||||
This will run `nix-build ./nixos/default.nix -A tests.list -A tests.of -A tests.attrs` in
|
||||
the nixpkgs checkout. Note: this will only run on x86_64-linux machines.
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
@grahamcofborg eval
|
||||
```
|
||||
|
|
|
@ -23,6 +23,17 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
|
|||
"build" => {
|
||||
instructions.push(Instruction::Build(Subset::Nixpkgs, right.to_vec()))
|
||||
}
|
||||
"test" => {
|
||||
instructions.push(
|
||||
Instruction::Build(Subset::NixOS,
|
||||
right
|
||||
.into_iter()
|
||||
.map(|attr| format!("tests.{}", attr))
|
||||
.collect()
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
"eval" => {
|
||||
instructions.push(Instruction::Eval)
|
||||
}
|
||||
|
@ -119,6 +130,16 @@ mod tests {
|
|||
baz"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_comment() {
|
||||
assert_eq!(Some(vec![Instruction::Build(Subset::NixOS, vec![
|
||||
String::from("tests.foo"),
|
||||
String::from("tests.bar"),
|
||||
String::from("tests.baz")
|
||||
])]),
|
||||
parse("@GrahamCOfBorg test foo bar baz"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_comment_newlines() {
|
||||
assert_eq!(Some(vec![Instruction::Build(Subset::Nixpkgs, vec![
|
||||
|
|
Loading…
Reference in a new issue