mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-19 15:41:36 +03:00
Merge branch 'feature/compiler-benchmarking' of github.com:AleoHQ/leo into feature/compiler-benchmarking
This commit is contained in:
commit
7b4e97c3af
@ -21,7 +21,7 @@ use std::{
|
|||||||
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
pub fn find_tests(path: &'_ Path) -> impl Iterator<Item = (PathBuf, String)> + '_ {
|
pub fn find_tests(path: &Path) -> impl Iterator<Item = (PathBuf, String)> {
|
||||||
WalkDir::new(path).into_iter().flatten().filter_map(move |f| {
|
WalkDir::new(path).into_iter().flatten().filter_map(move |f| {
|
||||||
let path = f.path();
|
let path = f.path();
|
||||||
path.extension().filter(|s| *s == "leo").map(|_| {
|
path.extension().filter(|s| *s == "leo").map(|_| {
|
||||||
|
@ -161,20 +161,14 @@ impl TestCases {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn clear_expectations(&self, path: &Path, expectation_category: &str) -> (PathBuf, Option<TestExpectation>) {
|
fn clear_expectations(&self, path: &Path, expectation_category: &str) -> (PathBuf, Option<TestExpectation>) {
|
||||||
let path = Path::new(&path);
|
let test_dir = [env!("CARGO_MANIFEST_DIR"), "../../tests/"].iter().collect::<PathBuf>();
|
||||||
let relative_path = path.strip_prefix(&self.path_prefix).expect("path error for test");
|
let relative_path = path.strip_prefix(&test_dir).expect("path error for test");
|
||||||
let expectation_dir = self.path_prefix.clone();
|
let expectation_path = test_dir
|
||||||
let mut expectation_path = expectation_dir;
|
.join("expectations")
|
||||||
expectation_path.push(expectation_category);
|
.join(expectation_category)
|
||||||
expectation_path.push(relative_path.parent().expect("no parent dir for test"));
|
.join(relative_path.parent().expect("no parent dir for test"))
|
||||||
let mut expectation_name = relative_path
|
.join(relative_path.file_name().expect("no file name for test"))
|
||||||
.file_name()
|
.with_extension("out");
|
||||||
.expect("no file name for test")
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.to_string();
|
|
||||||
expectation_name += ".out";
|
|
||||||
expectation_path.push(&expectation_name);
|
|
||||||
|
|
||||||
if expectation_path.exists() {
|
if expectation_path.exists() {
|
||||||
if !is_env_var_set("CLEAR_LEO_TEST_EXPECTATIONS") {
|
if !is_env_var_set("CLEAR_LEO_TEST_EXPECTATIONS") {
|
||||||
|
Loading…
Reference in New Issue
Block a user