test(codegen): uncomment passed tests that are related to trailing comments (#6589)

Just uncomment them and replace whitespace with `\t`
This commit is contained in:
Dunqing 2024-10-15 16:23:41 +00:00
parent 721cf0f8b4
commit e7c89a596b

View file

@ -182,11 +182,10 @@ fn test_new() {
// test_minify("new x() ** 2", "new x**2;"); // test_minify("new x() ** 2", "new x**2;");
// Test preservation of Webpack-specific comments // Test preservation of Webpack-specific comments
// TODO: Not support trailing comments yet test(
// test( "new Worker(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "new Worker(// webpackFoo: 1\n // webpackBar: 2\n 'path');", "new Worker(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\"\n);\n",
// "new Worker(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\n);\n", );
// );
test( test(
"new Worker(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');", "new Worker(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');",
"new Worker(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n", "new Worker(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",
@ -245,12 +244,12 @@ fn test_call() {
// testMangleMinify(t, "(1 ? eval : 2)?.(x)", "eval?.(x);"); // testMangleMinify(t, "(1 ? eval : 2)?.(x)", "eval?.(x);");
// Webpack-specific comments // Webpack-specific comments
// TODO: Not support trailing comments yet test(
// test( "require(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "import(// webpackFoo: 1\n // webpackBar: 2\n 'path');", "require(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\"\n);\n",
// "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\n);\n", );
// ); test( "require(// webpackFoo: 1\n // webpackBar: 2\n 'path', {type: 'module'});",
// test( "import(// webpackFoo: 1\n // webpackBar: 2\n 'path', {type: 'module'});", "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\",\n { type: \"module\" }\n);\n"); "require(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\",\n\t{ type: \"module\" }\n);\n");
test( test(
"require(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');", "require(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');",
"require(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n", "require(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",
@ -659,12 +658,11 @@ fn test_decorators() {
fn test_import() { fn test_import() {
test("import('path');", "import(\"path\");\n"); // The semicolon must not be a separate statement test("import('path');", "import(\"path\");\n"); // The semicolon must not be a separate statement
// TODO: Not support trailing comments yet test(
// test( "import(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "import(// webpackFoo: 1\n // webpackBar: 2\n 'path');", "import(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\"\n);\n",
// "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\n);\n", );
// ); test( "import(// webpackFoo: 1\n // webpackBar: 2\n 'path', {type: 'module'});", "import(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\",\n\t{ type: \"module\" }\n);\n");
// test( "import(// webpackFoo: 1\n // webpackBar: 2\n 'path', {type: 'module'});", "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\",\n { type: \"module\" }\n);\n");
test( test(
"import(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');", "import(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');",
"import(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n", "import(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",