Remove 'seed' arg from 'with_project' to FinishedTests event

Also polish a bit the output of tests, move test result to stdout to allow filtering out warnings by redirecting stderr to /dev/null.
This commit is contained in:
KtorZ
2024-03-04 18:43:39 +01:00
parent c9dd281b45
commit df3baa082e
10 changed files with 76 additions and 92 deletions

View File

@@ -39,7 +39,7 @@ pub fn exec(
mainnet,
}: Args,
) -> miette::Result<()> {
with_project(directory.as_deref(), u32::default(), false, |p| {
with_project(directory.as_deref(), false, |p| {
if rebuild {
p.build(false, Tracing::silent())?;
}

View File

@@ -47,7 +47,7 @@ pub fn exec(
validator,
}: Args,
) -> miette::Result<()> {
with_project(None, u32::default(), false, |p| {
with_project(None, false, |p| {
let title = module.as_ref().map(|m| {
format!(
"{m}{}",

View File

@@ -29,7 +29,7 @@ pub fn exec(
rebuild,
}: Args,
) -> miette::Result<()> {
with_project(directory.as_deref(), u32::default(), false, |p| {
with_project(directory.as_deref(), false, |p| {
if rebuild {
p.build(false, Tracing::silent())?;
}

View File

@@ -29,7 +29,7 @@ pub fn exec(
rebuild,
}: Args,
) -> miette::Result<()> {
with_project(directory.as_deref(), u32::default(), false, |p| {
with_project(directory.as_deref(), false, |p| {
if rebuild {
p.build(false, Tracing::silent())?;
}

View File

@@ -51,23 +51,17 @@ pub fn exec(
}: Args,
) -> miette::Result<()> {
let result = if watch {
watch_project(
directory.as_deref(),
watch::default_filter,
u32::default(),
500,
|p| {
p.build(
uplc,
match filter_traces {
Some(filter_traces) => filter_traces(trace_level),
None => Tracing::All(trace_level),
},
)
},
)
watch_project(directory.as_deref(), watch::default_filter, 500, |p| {
p.build(
uplc,
match filter_traces {
Some(filter_traces) => filter_traces(trace_level),
None => Tracing::All(trace_level),
},
)
})
} else {
with_project(directory.as_deref(), u32::default(), deny, |p| {
with_project(directory.as_deref(), deny, |p| {
p.build(
uplc,
match filter_traces {
@@ -82,8 +76,8 @@ pub fn exec(
}
#[allow(clippy::type_complexity)]
pub fn filter_traces_parser(
) -> MapValueParser<PossibleValuesParser, fn(String) -> fn(TraceLevel) -> Tracing> {
pub fn filter_traces_parser()
-> MapValueParser<PossibleValuesParser, fn(String) -> fn(TraceLevel) -> Tracing> {
PossibleValuesParser::new(["user-defined", "compiler-generated", "all"]).map(
|s: String| match s.as_str() {
"user-defined" => Tracing::UserDefined,

View File

@@ -79,27 +79,21 @@ pub fn exec(
let seed = seed.unwrap_or_else(|| rng.gen());
let result = if watch {
watch_project(
directory.as_deref(),
watch::default_filter,
seed,
500,
|p| {
p.check(
skip_tests,
match_tests.clone(),
debug,
exact_match,
seed,
match filter_traces {
Some(filter_traces) => filter_traces(trace_level),
None => Tracing::All(trace_level),
},
)
},
)
watch_project(directory.as_deref(), watch::default_filter, 500, |p| {
p.check(
skip_tests,
match_tests.clone(),
debug,
exact_match,
seed,
match filter_traces {
Some(filter_traces) => filter_traces(trace_level),
None => Tracing::All(trace_level),
},
)
})
} else {
with_project(directory.as_deref(), seed, deny, |p| {
with_project(directory.as_deref(), deny, |p| {
p.check(
skip_tests,
match_tests.clone(),

View File

@@ -29,17 +29,11 @@ pub fn exec(
}: Args,
) -> miette::Result<()> {
let result = if watch {
watch_project(
directory.as_deref(),
watch::default_filter,
u32::default(),
500,
|p| p.docs(destination.clone()),
)
} else {
with_project(directory.as_deref(), u32::default(), deny, |p| {
watch_project(directory.as_deref(), watch::default_filter, 500, |p| {
p.docs(destination.clone())
})
} else {
with_project(directory.as_deref(), deny, |p| p.docs(destination.clone()))
};
result.map_err(|_| process::exit(1))