From 93d509db2b402cdced8e2473d3aed52b29ff24ae Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Fri, 27 Sep 2024 05:51:31 +0000 Subject: [PATCH] chore(codegen): `test` function reports duplicate error information (#6067) image --- crates/oxc_codegen/tests/integration/tester.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/crates/oxc_codegen/tests/integration/tester.rs b/crates/oxc_codegen/tests/integration/tester.rs index 8379400815490..10b2d6acf202f 100644 --- a/crates/oxc_codegen/tests/integration/tester.rs +++ b/crates/oxc_codegen/tests/integration/tester.rs @@ -15,10 +15,7 @@ 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) { @@ -26,10 +23,7 @@ pub fn test_without_source(source_text: &str, expected: &str) { 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) { @@ -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}"); }