Skip to content

Commit

Permalink
chore(codegen): test function reports duplicate error information (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Sep 27, 2024
1 parent b2760ec commit 93d509d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions crates/oxc_codegen/tests/integration/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,15 @@ pub fn test(source_text: &str, expected: &str) {
)
.build(&ret.program)
.source_text;
assert_eq!(
result, expected,
"\nfor source {source_text:?}\nexpect {expected:?}\ngot {result:?}"
);
assert_eq!(result, expected, "\nfor source: {source_text:?}");
}

pub fn test_without_source(source_text: &str, expected: &str) {
let source_type = SourceType::jsx();
let allocator = Allocator::default();
let ret = Parser::new(&allocator, source_text, source_type).parse();
let result = CodeGenerator::new().build(&ret.program).source_text;
assert_eq!(
result, expected,
"\nfor source {source_text:?}\nexpect {expected:?}\ngot {result:?}\nwithout providing the original code."
);
assert_eq!(result, expected, "\nfor source: {source_text:?}");
}

pub fn test_minify(source_text: &str, expected: &str) {
Expand All @@ -40,8 +34,5 @@ pub fn test_minify(source_text: &str, expected: &str) {
.with_options(CodegenOptions { minify: true, ..CodegenOptions::default() })
.build(&ret.program)
.source_text;
assert_eq!(
result, expected,
"\nfor minify source {source_text}\nexpect {expected}\ngot {result:?}"
);
assert_eq!(result, expected, "\nfor minify source: {source_text}");
}

0 comments on commit 93d509d

Please sign in to comment.