mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-01 02:08:31 +03:00
improved directory naming and skip pattern now allows multiple
This commit is contained in:
parent
5453225b5d
commit
9389e4f6ec
@ -40,7 +40,7 @@ struct Opt {
|
|||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
|
|
||||||
#[structopt(short, long, help = "Skip tests matching pattern")]
|
#[structopt(short, long, help = "Skip tests matching pattern")]
|
||||||
skip: Option<String>,
|
skip: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -59,7 +59,7 @@ fn run_with_args(opt: Opt) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare directory for placing results.
|
// Prepare directory for placing results.
|
||||||
for (index, (path, text)) in tests.iter().enumerate() {
|
'main_loop: for (index, (path, text)) in tests.iter().enumerate() {
|
||||||
if let Some(config) = extract_test_config(text) {
|
if let Some(config) = extract_test_config(text) {
|
||||||
// Skip namespaces that we don't need; also skip failure tests.
|
// Skip namespaces that we don't need; also skip failure tests.
|
||||||
if config.namespace != "Compile" || config.expectation == Expectation::Fail {
|
if config.namespace != "Compile" || config.expectation == Expectation::Fail {
|
||||||
@ -67,10 +67,10 @@ fn run_with_args(opt: Opt) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut test_name = path
|
let mut test_name = path
|
||||||
.split(std::path::MAIN_SEPARATOR)
|
.split("tests/")
|
||||||
.last()
|
.last()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.replace(".leo", "");
|
.replace(std::path::MAIN_SEPARATOR, "_");
|
||||||
|
|
||||||
// Filter out the tests that do not match pattern, if pattern is set.
|
// Filter out the tests that do not match pattern, if pattern is set.
|
||||||
if let Some(filter) = &opt.filter {
|
if let Some(filter) = &opt.filter {
|
||||||
@ -80,9 +80,12 @@ fn run_with_args(opt: Opt) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If skip flag is used, don't run tests matching the pattern.
|
// If skip flag is used, don't run tests matching the pattern.
|
||||||
if let Some(skip_name) = &opt.skip {
|
if let Some(skips) = &opt.skip {
|
||||||
if test_name.contains(skip_name) {
|
for skip_pattern in skips {
|
||||||
continue;
|
if test_name.contains(skip_pattern) {
|
||||||
|
println!("Skipping: {} because of {}", test_name, skip_pattern);
|
||||||
|
continue 'main_loop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user