forked from the-distro/ofborg
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
|
@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
|
@grahamcofborg eval
|
||||||
```
|
```
|
||||||
|
|
|
@ -23,6 +23,17 @@ pub fn parse(text: &str) -> Option<Vec<Instruction>> {
|
||||||
"build" => {
|
"build" => {
|
||||||
instructions.push(Instruction::Build(Subset::Nixpkgs, right.to_vec()))
|
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" => {
|
"eval" => {
|
||||||
instructions.push(Instruction::Eval)
|
instructions.push(Instruction::Eval)
|
||||||
}
|
}
|
||||||
|
@ -119,6 +130,16 @@ mod tests {
|
||||||
baz"));
|
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]
|
#[test]
|
||||||
fn build_comment_newlines() {
|
fn build_comment_newlines() {
|
||||||
assert_eq!(Some(vec![Instruction::Build(Subset::Nixpkgs, vec![
|
assert_eq!(Some(vec![Instruction::Build(Subset::Nixpkgs, vec![
|
||||||
|
|
Loading…
Reference in a new issue