mirror of
https://github.com/swc-project/swc.git
synced 2024-12-01 09:52:57 +03:00
fix(es/transforms/testing): Fix test_fixture
(#2400)
swc_ecma_transforms_testing: - Make logic depends on `NormalizedOutput::compare_to_file`.
This commit is contained in:
parent
d7f570ff7c
commit
f5607891e4
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2932,7 +2932,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "swc_ecma_transforms_testing"
|
||||
version = "0.38.0"
|
||||
version = "0.38.1"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1",
|
||||
"anyhow",
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "Apache-2.0/MIT"
|
||||
name = "swc_ecma_transforms_testing"
|
||||
repository = "https://github.com/swc-project/swc.git"
|
||||
version = "0.38.0"
|
||||
version = "0.38.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
@ -26,7 +26,7 @@ use swc_ecma_transforms_base::{
|
||||
use swc_ecma_utils::{quote_ident, quote_str, DropSpan, ExprFactory, HANDLER};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, FoldWith, VisitMut, VisitMutWith};
|
||||
use tempfile::tempdir_in;
|
||||
use testing::{assert_eq, find_executable, DebugUsingDisplay, NormalizedOutput};
|
||||
use testing::{assert_eq, find_executable, NormalizedOutput};
|
||||
|
||||
pub struct Tester<'a> {
|
||||
pub cm: Lrc<SourceMap>,
|
||||
@ -698,8 +698,6 @@ fn test_fixture_inner<P>(
|
||||
Ok(actual_src)
|
||||
});
|
||||
|
||||
let mut results = vec![];
|
||||
|
||||
if allow_error {
|
||||
NormalizedOutput::from(stderr)
|
||||
.compare_to_file(output.with_extension("stderr"))
|
||||
@ -719,25 +717,10 @@ fn test_fixture_inner<P>(
|
||||
return;
|
||||
}
|
||||
|
||||
if let Ok("1") = env::var("UPDATE").as_deref() {
|
||||
results.push(NormalizedOutput::from(actual_src.clone()).compare_to_file(output));
|
||||
}
|
||||
|
||||
if NormalizedOutput::from(actual_src.clone())
|
||||
== NormalizedOutput::from(expected_src.clone())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
DebugUsingDisplay(&actual_src),
|
||||
DebugUsingDisplay(&expected_src)
|
||||
);
|
||||
NormalizedOutput::from(actual_src.clone())
|
||||
.compare_to_file(output)
|
||||
.unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
for result in results {
|
||||
result.unwrap();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user