Skip to content

Commit

Permalink
test(codegen): uncomment passed tests that are related to trailing co…
Browse files Browse the repository at this point in the history
…mments (#6589)

Just uncomment them and replace whitespace with `\t`
  • Loading branch information
Dunqing committed Oct 15, 2024
1 parent 721cf0f commit e7c89a5
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions crates/oxc_codegen/tests/integration/esbuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ fn test_new() {
// test_minify("new x() ** 2", "new x**2;");

// Test preservation of Webpack-specific comments
// TODO: Not support trailing comments yet
// test(
// "new Worker(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "new Worker(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\n);\n",
// );
test(
"new Worker(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
"new Worker(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\"\n);\n",
);
test(
"new Worker(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');",
"new Worker(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",
Expand Down Expand Up @@ -245,12 +244,12 @@ fn test_call() {
// testMangleMinify(t, "(1 ? eval : 2)?.(x)", "eval?.(x);");

// Webpack-specific comments
// TODO: Not support trailing comments yet
// test(
// "import(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\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(
"require(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
"require(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\"\n);\n",
);
test( "require(// webpackFoo: 1\n // webpackBar: 2\n 'path', {type: 'module'});",
"require(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"path\",\n\t{ type: \"module\" }\n);\n");
test(
"require(/* webpackFoo: 1 */ /* webpackBar: 2 */ 'path');",
"require(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",
Expand Down Expand Up @@ -659,12 +658,11 @@ fn test_decorators() {
fn test_import() {
test("import('path');", "import(\"path\");\n"); // The semicolon must not be a separate statement

// TODO: Not support trailing comments yet
// test(
// "import(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
// "import(\n // webpackFoo: 1\n // webpackBar: 2\n \"path\"\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(
"import(// webpackFoo: 1\n // webpackBar: 2\n 'path');",
"import(\n\t// webpackFoo: 1\n\t// webpackBar: 2\n\t\"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 */ /* webpackBar: 2 */ 'path');",
"import(\n\t/* webpackFoo: 1 */\n\t/* webpackBar: 2 */\n\t\"path\"\n);\n",
Expand Down

0 comments on commit e7c89a5

Please sign in to comment.