From e557b795fccede9980966750d3e21a31b3f28785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 27 Oct 2022 08:54:53 +0900 Subject: [PATCH] Fix tests --- .../src/simplify/expr/tests.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs b/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs index 0fb0fc775ff4..b810fbfbf10d 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/expr/tests.rs @@ -977,15 +977,15 @@ fn test_fold_comparison4() { #[test] fn test_fold_get_elem1() { - fold("x = [,10][0]", "x = void 0"); - fold("x = [10, 20][0]", "x = 10"); - fold("x = [10, 20][1]", "x = 20"); + fold("x = [,10][0]", "x = (0, void 0)"); + fold("x = [10, 20][0]", "x = (0, 10)"); + fold("x = [10, 20][1]", "x = (0, 20)"); // fold("x = [10, 20][-1]", "x = void 0;"); // fold("x = [10, 20][2]", "x = void 0;"); fold("x = [foo(), 0][1]", "x = (foo(), 0);"); - fold("x = [0, foo()][1]", "x = foo()"); + fold("x = [0, foo()][1]", "x = (0, foo())"); // fold("x = [0, foo()][0]", "x = (foo(), 0)"); fold_same("for([1][0] in {});"); } @@ -1008,11 +1008,11 @@ fn test_fold_get_elem2_2() { #[test] fn test_fold_array_lit_spread_get_elem() { - fold("x = [...[0 ]][0]", "x = 0;"); - fold("x = [0, 1, ...[2, 3, 4]][3]", "x = 3;"); - fold("x = [...[0, 1], 2, ...[3, 4]][3]", "x = 3;"); - fold("x = [...[...[0, 1], 2, 3], 4][0]", "x = 0"); - fold("x = [...[...[0, 1], 2, 3], 4][3]", "x = 3"); + fold("x = [...[0 ]][0]", "x = (0, 0);"); + fold("x = [0, 1, ...[2, 3, 4]][3]", "x = (0, 3);"); + fold("x = [...[0, 1], 2, ...[3, 4]][3]", "x = (0, 3);"); + fold("x = [...[...[0, 1], 2, 3], 4][0]", "x = (0, 0)"); + fold("x = [...[...[0, 1], 2, 3], 4][3]", "x = (0, 3)"); // fold("x = [...[]][100]", "x = void 0;"); // fold("x = [...[0]][100]", "x = void 0;"); }